Commit e3588987 by Paolo Carlini Committed by Paolo Carlini

re PR c++/19200 (Friend declaration misinterpreted as constructor)

/cp
2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/19200
	* parser.c (cp_parser_init_declarator): Actually pass friend_p
	to cp_parser_declarator.

/testsuite
2014-06-11  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/19200
	* g++.dg/parse/friend11.C: New.

From-SVN: r211488
parent 8c80b86b
2014-06-11 Paolo Carlini <paolo.carlini@oracle.com> 2014-06-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/19200
* parser.c (cp_parser_init_declarator): Actually pass friend_p
to cp_parser_declarator.
2014-06-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60265 PR c++/60265
* parser.c (cp_parser_using_declaration): Handle unscoped enums. * parser.c (cp_parser_using_declaration): Handle unscoped enums.
* name-lookup.c (validate_nonmember_using_decl): Adjust error * name-lookup.c (validate_nonmember_using_decl): Adjust error
......
...@@ -16545,7 +16545,7 @@ cp_parser_init_declarator (cp_parser* parser, ...@@ -16545,7 +16545,7 @@ cp_parser_init_declarator (cp_parser* parser,
bool is_direct_init = false; bool is_direct_init = false;
bool is_non_constant_init; bool is_non_constant_init;
int ctor_dtor_or_conv_p; int ctor_dtor_or_conv_p;
bool friend_p; bool friend_p = cp_parser_friend_p (decl_specifiers);
tree pushed_scope = NULL_TREE; tree pushed_scope = NULL_TREE;
bool range_for_decl_p = false; bool range_for_decl_p = false;
bool saved_default_arg_ok_p = parser->default_arg_ok_p; bool saved_default_arg_ok_p = parser->default_arg_ok_p;
...@@ -16574,7 +16574,7 @@ cp_parser_init_declarator (cp_parser* parser, ...@@ -16574,7 +16574,7 @@ cp_parser_init_declarator (cp_parser* parser,
= cp_parser_declarator (parser, CP_PARSER_DECLARATOR_NAMED, = cp_parser_declarator (parser, CP_PARSER_DECLARATOR_NAMED,
&ctor_dtor_or_conv_p, &ctor_dtor_or_conv_p,
/*parenthesized_p=*/NULL, /*parenthesized_p=*/NULL,
member_p, /*friend_p=*/false); member_p, friend_p);
/* Gather up the deferred checks. */ /* Gather up the deferred checks. */
stop_deferring_access_checks (); stop_deferring_access_checks ();
...@@ -16746,9 +16746,6 @@ cp_parser_init_declarator (cp_parser* parser, ...@@ -16746,9 +16746,6 @@ cp_parser_init_declarator (cp_parser* parser,
decl_specifiers->type = integer_type_node; decl_specifiers->type = integer_type_node;
} }
/* Check to see whether or not this declaration is a friend. */
friend_p = cp_parser_friend_p (decl_specifiers);
/* Enter the newly declared entry in the symbol table. If we're /* Enter the newly declared entry in the symbol table. If we're
processing a declaration in a class-specifier, we wait until processing a declaration in a class-specifier, we wait until
after processing the initializer. */ after processing the initializer. */
......
2014-06-11 Paolo Carlini <paolo.carlini@oracle.com> 2014-06-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/19200
* g++.dg/parse/friend11.C: New.
2014-06-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/60265 PR c++/60265
* g++.dg/cpp0x/using-enum-1.C: New. * g++.dg/cpp0x/using-enum-1.C: New.
* g++.dg/cpp0x/using-enum-2.C: Likewise. * g++.dg/cpp0x/using-enum-2.C: Likewise.
......
// PR c++/19200
struct S {
struct T{};
template<typename> friend void S(T);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment