re PR c++/31446 (ICE with invalid template parameter)
authorPaolo Carlini <pcarlini@suse.de>
Tue, 16 Oct 2007 22:21:59 +0000 (22:21 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 16 Oct 2007 22:21:59 +0000 (22:21 +0000)
/cp
2007-10-16  Paolo Carlini  <pcarlini@suse.de>

PR c++/31446
* pt.c (current_template_args): Do not change TREE_LIST elements
with a TREE_VALUE of error_mark_node.

/testsuite
2007-10-16  Paolo Carlini  <pcarlini@suse.de>

PR c++/31446
* g++.dg/template/void11.C: New.
* g++.dg/template/void2.C: Adjust error markers.
* g++.dg/template/void10.C: Likewise.
* g++.dg/template/crash55.C: Likewise.

From-SVN: r129391

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

index 559226b..5fd1c1b 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-16  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/31446
+       * pt.c (current_template_args): Do not change TREE_LIST elements
+       with a TREE_VALUE of error_mark_node.
+
 2007-10-16  Mark Mitchell  <mark@codesourcery.com>
 
        * typeck.c (cp_apply_type_quals_to_decl): Expand documentation.
index c3ce0d1..773c104 100644 (file)
@@ -3136,8 +3136,8 @@ current_template_args (void)
                           TREE_TYPE (t) = type;
                         }
                     }
+                 TREE_VEC_ELT (a, i) = t;
                 }
-             TREE_VEC_ELT (a, i) = t;
            }
        }
 
index 3535b31..34f8c08 100644 (file)
@@ -1,3 +1,11 @@
+2007-10-16  Paolo Carlini  <pcarlini@suse.de>
+
+       PR c++/31446
+       * g++.dg/template/void11.C: New.
+       * g++.dg/template/void2.C: Adjust error markers.
+       * g++.dg/template/void10.C: Likewise.
+       * g++.dg/template/crash55.C: Likewise.
+
 2007-10-16  Mark Mitchell  <mark@codesourcery.com>
 
        * g++.dg/opt/const5.C: New test.
index 377603d..7cf9f1e 100644 (file)
@@ -1,6 +1,6 @@
 //PR c++/27668
 
 template<typename class T, T = T()> // { dg-error "nested-name-specifier|two or more|valid type" }
-struct A {};                        // { dg-error "definition|template" }
+struct A {};
 
 template<int> void foo(A<int>);     // { dg-error "mismatch|constant|template argument" }
index 56e0b6d..4904a28 100644 (file)
@@ -7,4 +7,4 @@ template<void> struct A                 // { dg-error "not a valid type" }
 
 template<typename> struct B {};
 
-B<int> b;                              // { dg-error "template argument|invalid type" }
+B<int> b;
diff --git a/gcc/testsuite/g++.dg/template/void11.C b/gcc/testsuite/g++.dg/template/void11.C
new file mode 100644 (file)
index 0000000..1aad7a1
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/31446
+
+template<void> struct A // { dg-error "valid type" }
+
+{
+  template<int> friend void foo();
+};
+
+void bar()
+{
+  foo<0>(); // { dg-error "not declared|primary-expression" }
+}
index 05a8186..eceb362 100644 (file)
@@ -3,7 +3,7 @@
 
 template<int> struct A
 {
-  template<void> friend class X;  // { dg-error "void" }
+  template<void> friend class X;  // { dg-error "void|valid type" }
 };
 
-A<0> a; 
+A<0> a;