re PR c++/52906 (ICE: SIGSEGV in check_tag_decl (decl.c:4230) with "__attribute__...
authorJason Merrill <jason@redhat.com>
Wed, 11 Apr 2012 17:55:12 +0000 (13:55 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 11 Apr 2012 17:55:12 +0000 (13:55 -0400)
PR c++/52906
* decl.c (check_tag_decl): Don't complain about attributes if we
don't even have a type.

From-SVN: r186345

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

index 3397470777ada9807ced9433320f68666dc63d1b..1f346008035f187431c124c8c82cfbb92bcc470e 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/52906
+       * decl.c (check_tag_decl): Don't complain about attributes if we
+       don't even have a type.
+
 2012-04-10  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        * cvt.c (convert_to_void): Update comment.
index e2f01d51ab72e4a0541e87018dee3fe78539046d..8b22192987fcbc78cea68f5bdec254cec60002b1 100644 (file)
@@ -4224,7 +4224,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
         error ("%<constexpr%> cannot be used for type declarations");
     }
 
-  if (declspecs->attributes && warn_attributes)
+  if (declspecs->attributes && warn_attributes && declared_type)
     {
       location_t loc;
       if (!CLASS_TYPE_P (declared_type)
index 3355e7e9604b367ba6700a67d87f61a0da839082..5fbbcfc84932789be569c0c292a16fa9f7ed15a9 100644 (file)
@@ -1,5 +1,8 @@
 2012-04-11  Jason Merrill  <jason@redhat.com>
 
+       PR c++/52906
+       * g++.dg/ext/attrib45.C: New.
+
        * g++.dg/eh/dtor3.C: New.
 
 2012-04-11  Richard Guenther  <rguenther@suse.de>
diff --git a/gcc/testsuite/g++.dg/ext/attrib45.C b/gcc/testsuite/g++.dg/ext/attrib45.C
new file mode 100644 (file)
index 0000000..0be1322
--- /dev/null
@@ -0,0 +1,3 @@
+// PR c++/52906
+
+__attribute__ ((__deprecated__)); // { dg-error "does not declare anything" }