re PR c++/64222 (error: ‘__FUNCTION__’ was not declared in this scope)

PR c++/64222
	* parser.c (cp_parser_unqualified_id): Don't declare fname while
	parsing function parms.

From-SVN: r218556
This commit is contained in:
Jason Merrill 2014-12-09 21:50:54 -05:00 committed by Jason Merrill
parent 6789ccfa46
commit 9c78f8e605
3 changed files with 27 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2014-12-09 Jason Merrill <jason@redhat.com>
PR c++/64222
* parser.c (cp_parser_unqualified_id): Don't declare fname while
parsing function parms.
2014-12-03 Jason Merrill <jason@redhat.com>
PR c++/64029

View file

@ -5207,7 +5207,10 @@ cp_parser_unqualified_id (cp_parser* parser,
case RID_PRETTY_FUNCTION_NAME:
case RID_C99_FUNCTION_NAME:
cp_lexer_consume_token (parser->lexer);
finish_fname (token->u.value);
/* Don't try to declare this while tentatively parsing a function
declarator, as cp_make_fname_decl will fail. */
if (current_binding_level->kind != sk_function_parms)
finish_fname (token->u.value);
return token->u.value;
default:

View file

@ -0,0 +1,17 @@
// PR c++/64222
class A
{
public:
A (const char *, void *);
};
class B
{
public:
B (A);
};
void
fn1 ()
{
B a (A (__func__, 0));
}