Commit 9e0541d9 by Jason Merrill Committed by Jason Merrill

re PR c++/48046 (Expected diagnostic "reference to 'type' is ambiguous" not…

re PR c++/48046 (Expected diagnostic "reference to  'type' is ambiguous" not given for function-local static declaration)

	PR c++/48046
	* parser.c (cp_parser_diagnose_invalid_type_name): Commit
	to tentative parse sooner.

From-SVN: r173036
parent 7036ee24
2011-04-27 Jason Merrill <jason@redhat.com>
PR c++/48046
* parser.c (cp_parser_diagnose_invalid_type_name): Commit
to tentative parse sooner.
2011-04-26 Jason Merrill <jason@redhat.com>
PR c++/42687
......
......@@ -2440,6 +2440,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser,
location_t location)
{
tree decl, old_scope;
cp_parser_commit_to_tentative_parse (parser);
/* Try to lookup the identifier. */
old_scope = parser->scope;
parser->scope = scope;
......@@ -2533,7 +2534,6 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser,
else
gcc_unreachable ();
}
cp_parser_commit_to_tentative_parse (parser);
}
/* Check for a common situation where a type-name should be present,
......
2011-04-27 Jason Merrill <jason@redhat.com>
* g++.dg/parse/ambig6.C: New.
2011-04-27 Nick Clifton <nickc@redhat.com>
* gcc.dg/20020312-2.c: Add definition for RX.
......
// PR c++/48046
namespace N1 { typedef int T; } // { dg-error "" }
namespace N2 { typedef float T; } // { dg-error "" }
int main()
{
using namespace N1;
using namespace N2;
static T t; // { dg-error "" }
}
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