OSDN Git Service

* parser.c (cp_parser_explicit_instantiation): Give a warning
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Feb 2012 01:56:56 +0000 (01:56 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Feb 2012 01:56:56 +0000 (01:56 +0000)
for ignored attributes on explicit class instantiation.

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

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

index f7cafec..864b6d3 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-14  Jason Merrill  <jason@redhat.com>
+
+       * parser.c (cp_parser_explicit_instantiation): Give a warning
+       for ignored attributes on explicit class instantiation.
+
 2012-02-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/52247
index 491f48e..3e2be97 100644 (file)
@@ -13122,6 +13122,9 @@ cp_parser_explicit_instantiation (cp_parser* parser)
       tree type;
 
       type = check_tag_decl (&decl_specifiers);
+      if (decl_specifiers.attributes)
+       warning (OPT_Wattributes,
+                "attributes ignored on explicit type instantiation");
       /* Turn access control back on for names used during
         template instantiation.  */
       pop_deferring_access_checks ();
index 1a583e5..a7963aa 100644 (file)
@@ -1,3 +1,7 @@
+2012-02-14  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/ext/attrib43.C: New.
+
 2012-02-14  Hans-Peter Nilsson  <hp@axis.com>
 
        * lib/target-supports.exp (check_effective_target_fgnu_tm): New
diff --git a/gcc/testsuite/g++.dg/ext/attrib43.C b/gcc/testsuite/g++.dg/ext/attrib43.C
new file mode 100644 (file)
index 0000000..fe9f072
--- /dev/null
@@ -0,0 +1,5 @@
+template <class T> struct A { };
+
+template
+__attribute__ ((packed))
+struct A<int>;                 // { dg-warning "attributes ignored" }