re PR c++/36404 (ICE with invalid enum)
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 2 Jun 2008 21:27:35 +0000 (21:27 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 2 Jun 2008 21:27:35 +0000 (21:27 +0000)
/cp
2008-06-02  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/36404
        * pt.c (push_template_decl_real): Consistently return error_mark_node
on error.

/testsuite
2008-06-02  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/36404
        * g++.dg/template/crash79.C: New.
* g++.dg/other/pr28114.C: Adjust.

From-SVN: r136295

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

index 6fe0199de485fd9f7dbce4b23039be891bcb44b2..54afddc98519bfe287aa36716ee7d12809d784d4 100644 (file)
@@ -1,3 +1,9 @@
+2008-06-02  Paolo Carlini  <paolo.carlini@oracle.com>
+
+        PR c++/36404
+        * pt.c (push_template_decl_real): Consistently return error_mark_node
+       on error.
+
 2008-06-02  Tomas Bily  <tbily@suse.cz>
 
         * typeck.c (is_bitfield_expr_with_lowered_type): Use CASE_CONVERT.
index 95440c980230a43dd895f221b69c24b692ebc9b7..4bb43addb74b730e487781e54d38fe8f40b34503 100644 (file)
@@ -3791,7 +3791,10 @@ push_template_decl_real (tree decl, bool is_friend)
        member_template_p = true;
       if (TREE_CODE (decl) == TYPE_DECL
          && ANON_AGGRNAME_P (DECL_NAME (decl)))
-       error ("template class without a name");
+       {
+         error ("template class without a name");
+         return error_mark_node;
+       }
       else if (TREE_CODE (decl) == FUNCTION_DECL)
        {
          if (DECL_DESTRUCTOR_P (decl))
index 6cacd32cdb57a22b032bc7af71e6ccc0dd4b37c8..0bfe14a35383a511c75684ebcd9bfcc7f2e54826 100644 (file)
@@ -1,3 +1,9 @@
+2008-06-02  Paolo Carlini  <paolo.carlini@oracle.com>
+
+        PR c++/36404
+        * g++.dg/template/crash79.C: New.
+       * g++.dg/other/pr28114.C: Adjust.       
+
 2008-06-02  Daniel Kraft  <d@domob.eu>
 
        * finalize_1.f08:  New test.
index 05aeebb805558ee816add0e4fcf7a273604caecf..e16f6b589e5f686e6a255e813c926baff36d9a67 100644 (file)
@@ -5,5 +5,5 @@ template<int> void foo(struct {}*); // { dg-error "" }
 
 void bar()
 {
-  foo<0>(0); // { dg-error "" }
+  foo<0>(0);
 }
diff --git a/gcc/testsuite/g++.dg/template/crash79.C b/gcc/testsuite/g++.dg/template/crash79.C
new file mode 100644 (file)
index 0000000..be71848
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/36404
+
+struct A
+{
+  A(int);
+  template<int> enum { e }; // { dg-error "template" }
+};
+
+A a(A::e); // { dg-error "not a member" }