This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH to cp_parser_elaborated_type_specifier for c++/28559


The testcase crashes when we try to test whether a TYPENAME_TYPE is a template instantiation. So check for that too, and ignore the attributes; it doesn't make any sense to apply attributes to a TYPENAME_TYPE.

Tested x86_64-pc-linux-gnu, applied to trunk.
2006-08-11  Jason Merrill  <jason@redhat.com>

	PR c++/28559
	* parser.c (cp_parser_elaborated_type_specifier): Also ignore
	attributes applied to a TYPENAME_TYPE.

Index: parser.c
===================================================================
*** parser.c	(revision 116129)
--- parser.c	(working copy)
*************** cp_parser_elaborated_type_specifier (cp_
*** 10268,10275 ****
    /* Allow attributes on forward declarations of classes.  */
    if (attributes)
      {
!       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))
--- 10268,10278 ----
    /* Allow attributes on forward declarations of classes.  */
    if (attributes)
      {
!       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))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]