re PR c++/13957 (Insufficient diagnostic for dependent expression parsed as non-type...
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>
Mon, 2 Feb 2004 01:11:03 +0000 (01:11 +0000)
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>
Mon, 2 Feb 2004 01:11:03 +0000 (01:11 +0000)
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.

From-SVN: r77091

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/non-type-template-argument-1.C
gcc/testsuite/g++.dg/template/nontype6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/qualified-id1.C

index afd9ce64f244c10e58db831dd1b2e2b6713ec0c4..87fe8b74ef5b7f344e882d2e003e0bc8467677d8 100644 (file)
@@ -1,3 +1,10 @@
+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}.
index 273017635c3f2097f43d0368a9cf40fe98d1967f..9d400d5b10433319a7f6182fed3f74e55426168e 100644 (file)
@@ -6,7 +6,7 @@ template <bool> struct C {};
 
 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" }
diff --git a/gcc/testsuite/g++.dg/template/nontype6.C b/gcc/testsuite/g++.dg/template/nontype6.C
new file mode 100644 (file)
index 0000000..43470cc
--- /dev/null
@@ -0,0 +1,19 @@
+// { 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" }
index bbe23c2743b3fa89dc317183a005e2902e286b24..967764281c03f20b6ccb63cba3e137f493d29921 100644 (file)
@@ -16,8 +16,8 @@ template <> struct A::B<false> {};
 
 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()