re PR c++/21369 (Template function definition rejected if function return type begins with 'struct')
PR c++/21369 * parser.c (cp_parser_elaborated_type_specifier): Don't treat class types as templates if the type is not appearing as part of a type definition or declaration. PR c++/21369 * g++.dg/parse/ret-type3.C: New test. From-SVN: r105241
This commit is contained in:
parent
386cfa6f3f
commit
ca85f65910
|
@ -1,3 +1,10 @@
|
|||
2005-10-11 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/21369
|
||||
* parser.c (cp_parser_elaborated_type_specifier): Don't treat
|
||||
class types as templates if the type is not appearing as part of a
|
||||
type definition or declaration.
|
||||
|
||||
2005-10-10 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/24277
|
||||
|
|
|
@ -10066,6 +10066,8 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
|
|||
declaration context. */
|
||||
|
||||
tag_scope ts;
|
||||
bool template_p;
|
||||
|
||||
if (is_friend)
|
||||
/* Friends have special name lookup rules. */
|
||||
ts = ts_within_enclosing_non_class;
|
||||
|
@ -10082,8 +10084,11 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
|
|||
warning (OPT_Wattributes,
|
||||
"type attributes are honored only at type definition");
|
||||
|
||||
type = xref_tag (tag_type, identifier, ts,
|
||||
parser->num_template_parameter_lists);
|
||||
template_p =
|
||||
(parser->num_template_parameter_lists
|
||||
&& (cp_parser_next_token_starts_class_definition_p (parser)
|
||||
|| cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON)));
|
||||
type = xref_tag (tag_type, identifier, ts, template_p);
|
||||
}
|
||||
}
|
||||
if (tag_type != enum_type)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2005-10-11 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/21369
|
||||
* g++.dg/parse/ret-type3.C: New test.
|
||||
|
||||
2005-10-11 Andrew Pinski <pinskia@physics.uc.edu>
|
||||
|
||||
PR tree-opt/23946
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// PR c++/21369
|
||||
|
||||
struct bar;
|
||||
|
||||
template <class T> struct bar *foo (T *p)
|
||||
{
|
||||
return p->t;
|
||||
}
|
Loading…
Reference in New Issue