re PR c++/8772 (misleading diagnostic for template template parameter)
authorKriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Thu, 1 May 2003 11:36:19 +0000 (11:36 +0000)
committerKriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org>
Thu, 1 May 2003 11:36:19 +0000 (11:36 +0000)
PR c++/8772
* pt.c (convert_template_argument): Correct diagnostic.

* g++.dg/template/ttp5.C: New test.

From-SVN: r66324

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/ttp5.C [new file with mode: 0644]

index eb5b26ee42c9565d2ce207a17641bd7143c80bc1..c68ca29b2766fb64087eefad95ad119e88a5549d 100644 (file)
@@ -1,3 +1,8 @@
+2003-05-01  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/8772
+       * pt.c (convert_template_argument): Correct diagnostic.
+
 2003-04-30  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/9432, c++/9528
index 52df60b59cf84991e6697fe88878fe87d817f14d..73ada265efaf92a2db15e35b009cb7bbddf36cbc 100644 (file)
@@ -3579,6 +3579,8 @@ convert_template_argument (parm, arg, args, complain, i, in_decl)
                error ("  expected a constant of type `%T', got `%T'",
                          TREE_TYPE (parm),
                          (is_tmpl_type ? DECL_NAME (arg) : arg));
+             else if (requires_tmpl_type)
+               error ("  expected a class template, got `%E'", arg);
              else
                error ("  expected a type, got `%E'", arg);
            }
index 2387d53b8bcedc6dca744f1603bd947215bc8709..6dcbe62d272c3674b77657b38ecc8a0cca41e61c 100644 (file)
@@ -1,3 +1,8 @@
+2003-05-01  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
+
+       PR c++/8772
+       * g++.dg/template/ttp5.C: New test.
+
 2003-04-30  Mark Mitchell  <mark@codesourcery.com>
 
        * lib/g++-dg.exp (g++-dg-test): Add "repo" option.
diff --git a/gcc/testsuite/g++.dg/template/ttp5.C b/gcc/testsuite/g++.dg/template/ttp5.C
new file mode 100644 (file)
index 0000000..d26b816
--- /dev/null
@@ -0,0 +1,20 @@
+// { dg-do compile }
+
+// Origin: sneechy@hotmail.com
+
+// PR c++/8772: Incorrect diagnostics for template template parameter
+// mismatch
+
+template <int> struct A {
+  template <int> struct B {
+    enum { v = 1 };
+  };
+};
+
+template <template <int> class F> struct C {
+  enum { v = F<1>::v || 2 }; 
+};
+
+template <int n> struct D {
+  enum { v = C<A<n>::B>::v }; // { dg-error "mismatch|class template|not a member" }
+};