diff options
author | Jason Merrill <jason@redhat.com> | 2008-01-23 05:11:58 +0000 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2008-01-23 05:11:58 +0000 |
commit | 4c1bde4dc61c803b92470be3a2ac038dee7607e1 (patch) | |
tree | 1dfbc47f25968e7460e50b79ca7cbd5dcdc52fea | |
parent | f082fba34dd2decf3a1995196bba70b38bac05df (diff) |
PR c++/28560
* decl.c (groktypename): Also ignore attributes on dependent
possibly-class types.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@131755 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/tmplattr8.C | 8 |
3 files changed, 18 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f9971d4943d..667f813b594 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -9,6 +9,10 @@ 2008-01-22 Jason Merrill <jason@redhat.com> + PR c++/28560 + * decl.c (groktypename): Also ignore attributes on dependent + possibly-class types. + PR c++/34912 * friend.c (do_friend): Check for prior declaration of a friend function of a local class. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 338e1ed5676..4640adfb1c6 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3908,8 +3908,12 @@ groktypename (cp_decl_specifier_seq *type_specifiers, if (attrs) { if (CLASS_TYPE_P (type)) - warning (OPT_Wattributes, "ignoring attributes applied to class type " - "outside of definition"); + warning (OPT_Wattributes, "ignoring attributes applied to class type %qT " + "outside of definition", type); + else if (IS_AGGR_TYPE (type)) + /* A template type parameter or other dependent type. */ + warning (OPT_Wattributes, "ignoring attributes applied to dependent " + "type %qT without an associated declaration", type); else cplus_decl_attributes (&type, attrs, 0); } diff --git a/gcc/testsuite/g++.dg/ext/tmplattr8.C b/gcc/testsuite/g++.dg/ext/tmplattr8.C new file mode 100644 index 00000000000..4b8707aa538 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/tmplattr8.C @@ -0,0 +1,8 @@ +// PR c++/28560 + +template<typename> struct A {}; + +template<int> struct B; + +template<int N> struct C : + A<typename B<N>::X __attribute__((unused))> {}; // { dg-warning "attribute" } |