From 7f3dee0e1cd3024cef687846f55b5981dccce926 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 14 Feb 2012 20:56:56 -0500 Subject: [PATCH] parser.c (cp_parser_explicit_instantiation): Give a warning for ignored attributes on explicit class instantiation. * parser.c (cp_parser_explicit_instantiation): Give a warning for ignored attributes on explicit class instantiation. From-SVN: r184254 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/parser.c | 3 +++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/ext/attrib43.C | 5 +++++ 4 files changed, 17 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ext/attrib43.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f7cafec320e..864b6d34506 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2012-02-14 Jason Merrill + + * parser.c (cp_parser_explicit_instantiation): Give a warning + for ignored attributes on explicit class instantiation. + 2012-02-14 Jakub Jelinek PR c++/52247 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 491f48e0fcc..3e2be97f9c9 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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 (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1a583e5ed2f..a7963aab233 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2012-02-14 Jason Merrill + + * g++.dg/ext/attrib43.C: New. + 2012-02-14 Hans-Peter Nilsson * 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 index 00000000000..fe9f0727cf6 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib43.C @@ -0,0 +1,5 @@ +template struct A { }; + +template +__attribute__ ((packed)) +struct A; // { dg-warning "attributes ignored" }