From abab460491408e05ea93fb85e1975296a87df504 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 14 Aug 2006 17:25:03 -0400 Subject: [PATCH] re PR c++/28559 (ICE with friend and __attribute__) PR c++/28559 * parser.c (cp_parser_elaborated_type_specifier): Also ignore attributes applied to a TYPENAME_TYPE. From-SVN: r116137 --- gcc/cp/ChangeLog | 36 +++++++++++++++++------------ gcc/cp/parser.c | 7 ++++-- gcc/testsuite/g++.dg/ext/attrib25.C | 11 +++++++++ 3 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ext/attrib25.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1106f86b0c7..5737a628211 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,27 +1,33 @@ +2006-08-11 Jason Merrill + + PR c++/28559 + * parser.c (cp_parser_elaborated_type_specifier): Also ignore + attributes applied to a TYPENAME_TYPE. + 2006-08-09 Lee Millward - PR c++/28637 - * pt.c (coerce_template_parms): Copy across the - invalid template arguments to the new template inner arguments. - (retrieve_specialization): Robustify. + PR c++/28637 + * pt.c (coerce_template_parms): Copy across the + invalid template arguments to the new template inner arguments. + (retrieve_specialization): Robustify. - PR c++/28638 - * pt.c (coerce_template_template_parms): Robustify. + PR c++/28638 + * pt.c (coerce_template_template_parms): Robustify. - PR c++/28639 - * error.c (dump_template_parms): Robustify. + PR c++/28639 + * error.c (dump_template_parms): Robustify. - PR c++/28640 - * pt.c (redeclare_class_template): Robustify. + PR c++/28640 + * pt.c (redeclare_class_template): Robustify. - PR c++/28641 - * pt.c (type_unification_real): Robustify. + PR c++/28641 + * pt.c (type_unification_real): Robustify. 2006-08-03 Lee Millward - PR c++/28347 - * decl.c (start_decl): Return error_mark_node if a - diagnostic was issed for an invalid typedef initialization. + PR c++/28347 + * decl.c (start_decl): Return error_mark_node if a + diagnostic was issed for an invalid typedef initialization. 2006-08-03 Volker Reichelt diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index aa297874f30..35ce410e38f 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -10268,8 +10268,11 @@ cp_parser_elaborated_type_specifier (cp_parser* parser, /* Allow attributes on forward declarations of classes. */ if (attributes) { - if (tag_type != enum_type && CLASSTYPE_TEMPLATE_INSTANTIATION (type) - && ! processing_explicit_instantiation) + if (TREE_CODE (type) == TYPENAME_TYPE) + warning (OPT_Wattributes, + "attributes ignored on uninstantiated type"); + else if (tag_type != enum_type && CLASSTYPE_TEMPLATE_INSTANTIATION (type) + && ! processing_explicit_instantiation) warning (OPT_Wattributes, "attributes ignored on template instantiation"); else if (is_declaration && cp_parser_declares_only_class_p (parser)) diff --git a/gcc/testsuite/g++.dg/ext/attrib25.C b/gcc/testsuite/g++.dg/ext/attrib25.C new file mode 100644 index 00000000000..aeffdffe30a --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib25.C @@ -0,0 +1,11 @@ +// PR c++/28559 + +template struct A +{ + struct B; +}; + +struct C +{ + template friend struct __attribute__((packed)) A::B; // { dg-warning "uninstantiated" } +}; -- 2.30.2