* g++.dg/template/non-type-template-argument-1.C,
g++.dg/template/qualified-id1.C: Update dg-error marks.
* g++.dg/template/nontype6.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77091
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-02-01 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/13957
+ * g++.dg/template/non-type-template-argument-1.C,
+ g++.dg/template/qualified-id1.C: Update dg-error marks.
+ * g++.dg/template/nontype6.C: New test.
+
2004-02-01 Roger Sayle <roger@eyesopen.com>
* gcc.dg/builtins-1.c: Also test for __builtin_signbit{,f,l}.
template <typename T> struct D
{
- C<T::X> c; // { dg-error "names a type" }
+ C<T::X> c; // { dg-error "parsed as a non-type|if a type is meant" }
};
-D<B> d; // { dg-error "" }
+D<B> d; // { dg-error "instantiated from here" }
--- /dev/null
+// { dg-do compile }
+// Origin: <v dot haisman at sh dot cvut dot cz>
+// PR c++/13957: Improved error message for type in template (when non-type
+// is expected).
+
+template <class T>
+struct A
+{
+ typedef int type;
+};
+
+template <class T>
+void func(void)
+{
+ (void)A<T>::type(); // { dg-error "if a type is meant" }
+// { dg-error "parsed as a non-type" "" { target *-*-* } 15 }
+}
+
+template void func<float>(void); // { dg-error "instantiated from here" }
template <typename T> void foo()
{
- T::C (); // { dg-error "names a type" "" }
- T::template B<false>(); // { dg-error "names a type" "" }
+ T::C (); // { dg-error "parsed as a non-type|if a type is meant" "" }
+ T::template B<false>(); // { dg-error "parsed as a non-type|if a type is meant" "" }
}
void bar()