OSDN Git Service

PR c++/52906
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Apr 2012 17:55:12 +0000 (17:55 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 11 Apr 2012 17:55:12 +0000 (17:55 +0000)
* decl.c (check_tag_decl): Don't complain about attributes if we
don't even have a type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186345 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 3397470..1f34600 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 e2f01d5..8b22192 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 3355e7e..5fbbcfc 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" }