OSDN Git Service

PR c++/52906
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 13 Apr 2012 19:44:15 +0000 (19:44 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 13 Apr 2012 19:44:15 +0000 (19:44 +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/branches/gcc-4_7-branch@186435 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 d846b9e..f098425 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-05  Jason Merrill  <jason@redhat.com>
 
        PR c++/52596
index 0955a2d..1cf78b0 100644 (file)
@@ -4216,7 +4216,7 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
         error ("%<constexpr%> cannot be used for type declarations");
     }
 
-  if (declspecs->attributes)
+  if (declspecs->attributes && declared_type)
     {
       location_t loc = input_location;
       if (!CLASS_TYPE_P (declared_type)
index 21a6c95..2c9a34c 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-11  Jason Merrill  <jason@redhat.com>
+
+       PR c++/52906
+       * g++.dg/ext/attrib45.C: New.
+
 2012-04-13  Tom de Vries  <tom@codesourcery.com>
 
        Backport from mainline r186419.
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" }