PR c++/52671
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Mar 2012 20:25:02 +0000 (20:25 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Mar 2012 20:25:02 +0000 (20:25 +0000)
* decl.c (check_tag_decl): Only use CLASSTYPE_TEMPLATE_INSTANTIATION
on CLASS_TYPE_P types.

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

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

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

index 370fd7a..7da7f59 100644 (file)
@@ -1,3 +1,9 @@
+2012-03-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/52671
+       * decl.c (check_tag_decl): Only use CLASSTYPE_TEMPLATE_INSTANTIATION
+       on CLASS_TYPE_P types.
+
 2012-03-20  Jason Merrill  <jason@redhat.com>
 
        * lex.c (init_reswords): Use >= for cxx_dialect test.
index 2b2a551..e664d43 100644 (file)
@@ -4219,7 +4219,8 @@ check_tag_decl (cp_decl_specifier_seq *declspecs)
   if (declspecs->attributes && warn_attributes)
     {
       location_t loc;
-      if (!CLASSTYPE_TEMPLATE_INSTANTIATION (declared_type))
+      if (!CLASS_TYPE_P (declared_type)
+         || !CLASSTYPE_TEMPLATE_INSTANTIATION (declared_type))
        /* For a non-template class, use the name location.  */
        loc = location_of (declared_type);
       else
index 0e66883..36bb18b 100644 (file)
@@ -1,3 +1,8 @@
+2012-03-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/52671
+       * g++.dg/ext/attrib44.C: New test.
+
 2012-03-22  Jan Hubicka  <jh@suse.cz>
 
        PR middle-end/51737
diff --git a/gcc/testsuite/g++.dg/ext/attrib44.C b/gcc/testsuite/g++.dg/ext/attrib44.C
new file mode 100644 (file)
index 0000000..ae08191
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/52671
+// { dg-do compile }
+__attribute__ ((deprecated)) enum E { E0 };    // { dg-warning "attribute ignored in declaration of" }
+// { dg-message "must follow the" "" { target *-*-* } 3 }