re PR c++/28387 (ICE with attribute on invalid declaration)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Sat, 15 Jul 2006 09:22:17 +0000 (09:22 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Sat, 15 Jul 2006 09:22:17 +0000 (09:22 +0000)
PR c++/28387
* decl2.c (cplus_decl_attributes): Check for invalid decls.

* g++.dg/ext/attrib24.C: New test.

From-SVN: r115465

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/attrib24.C [new file with mode: 0644]

index d8b8652f913a544c67fae9a43f071d7117089957..4b35a3d37d4655a35794f59bbb4e3f9cda8f1e78 100644 (file)
@@ -1,3 +1,8 @@
+2006-07-15  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/28387
+       * decl2.c (cplus_decl_attributes): Check for invalid decls.
+
 2006-07-14  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/28343
index 11c4901cb3ad6fce6221fdcc4245756498fc43de..3b4e7ce02fbd35dd80a14024a795250de4a8dcd8 100644 (file)
@@ -997,7 +997,8 @@ grokbitfield (const cp_declarator *declarator,
 void
 cplus_decl_attributes (tree *decl, tree attributes, int flags)
 {
-  if (*decl == NULL_TREE || *decl == void_type_node)
+  if (*decl == NULL_TREE || *decl == void_type_node
+      || *decl == error_mark_node)
     return;
 
   if (TREE_CODE (*decl) == TEMPLATE_DECL)
index fa86c8121cace8859f28268a26f9fe65a5168b7e..d9edf48b3be203c4c5b5cea4ee79e652995dbd97 100644 (file)
@@ -1,3 +1,8 @@
+2006-07-15  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       PR c++/28387
+       * g++.dg/ext/attrib24.C: New test.
+
 2006-07-14  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/28343
diff --git a/gcc/testsuite/g++.dg/ext/attrib24.C b/gcc/testsuite/g++.dg/ext/attrib24.C
new file mode 100644 (file)
index 0000000..208809a
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/28387
+// { dg-do compile }
+
+enum __attribute__((unused)) E;  // { dg-error "without previous declaration" }