]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/30534 (ICE with invalid template argument)
authorVolker Reichelt <reichelt@netcologne.de>
Thu, 8 Mar 2007 07:26:43 +0000 (07:26 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Thu, 8 Mar 2007 07:26:43 +0000 (07:26 +0000)
PR c++/30534
* pt.c (any_template_arguments_need_structural_equality_p):
Robustify.

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

From-SVN: r122685

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

index de0dfd425f1f9d9fd6b7b0d02503d85753c29451..35e0f9fdfe16861fb1929e9c70e2f32603b5fe66 100644 (file)
@@ -1,3 +1,9 @@
+2007-03-08  Volker Reichelt  <reichelt@netcologne.de>
+
+       PR c++/30534
+       * pt.c (any_template_arguments_need_structural_equality_p):
+       Robustify.
+
 2007-03-08  Alexandre Oliva  <aoliva@redhat.com>
 
        * decl.c (grokdeclarator): Disable warnings for anonymous
index 8ade0a095c5f31c46337dd99140293a7f4a8c5ca..84ff4219ee3b7a89d02c0ea10ebce01f436848e4 100644 (file)
@@ -13131,7 +13131,9 @@ any_template_arguments_need_structural_equality_p (tree args)
       for (j = 0; j < TREE_VEC_LENGTH (level); ++j)
        {
          tree arg = TREE_VEC_ELT (level, j);
-         if (TREE_CODE (arg) == TEMPLATE_DECL
+         if (error_operand_p (arg))
+           return true;
+         else if (TREE_CODE (arg) == TEMPLATE_DECL
              || TREE_CODE (arg) == TEMPLATE_TEMPLATE_PARM)
            continue;
          else if (TYPE_P (arg) && TYPE_STRUCTURAL_EQUALITY_P (arg))
index 7d2b3235c1d81901f8297048cd75c638f6fea3f7..28c386f06d745b0e03141b4d4607ed6887a09085 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-08  Volker Reichelt  <reichelt@netcologne.de>
+
+       PR c++/30534
+       * g++.dg/template/arg5.C: New test.
+
 2007-03-07  Joseph Myers  <joseph@codesourcery.com>
 
        * g++.dg/eh/arm-iwmmxt-unwind.C: New test.
diff --git a/gcc/testsuite/g++.dg/template/arg5.C b/gcc/testsuite/g++.dg/template/arg5.C
new file mode 100644 (file)
index 0000000..3d67143
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/30534
+// { dg-do compile }
+
+template<bool> struct A;
+
+template<int> void foo()
+{
+  A<__builtin_constant_p(.)> a;  // { dg-error "template argument" }
+}