re PR c++/51226 ([c++0x] ICE with opaque enum and invalid template)

/cp
2013-05-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51226
	* parser.c (cp_parser_enum_specifier): Handle nested_name_specifier
	== error_mark_node.

/testsuite
2013-05-08  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51226
	* g++.dg/cpp0x/pr51226.C: New.

From-SVN: r198714
This commit is contained in:
Paolo Carlini 2013-05-08 15:22:03 +00:00
parent e61e7d2846
commit b0cda57f7b
4 changed files with 25 additions and 2 deletions
gcc

View File

@ -1,3 +1,9 @@
2013-05-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51226
* parser.c (cp_parser_enum_specifier): Handle nested_name_specifier
== error_mark_node.
2013-05-06 Marc Glisse <marc.glisse@inria.fr>
* typeck.c (cp_build_binary_op): Call save_expr before

View File

@ -14856,6 +14856,8 @@ cp_parser_enum_specifier (cp_parser* parser)
type = NULL_TREE;
}
}
else if (nested_name_specifier == error_mark_node)
/* We already issued an error. */;
else
error_at (type_start_token->location,
"%qD is not an enumerator-name", identifier);
@ -14965,7 +14967,8 @@ cp_parser_enum_specifier (cp_parser* parser)
if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_BRACE))
{
timevar_push (TV_PARSE_ENUM);
if (nested_name_specifier)
if (nested_name_specifier
&& nested_name_specifier != error_mark_node)
{
/* The following catches invalid code such as:
enum class S<int>::E { A, B, C }; */

View File

@ -1,3 +1,8 @@
2013-05-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51226
* g++.dg/cpp0x/pr51226.C: New.
2013-04-16 Han Shen <shenhan@google.com>
Test cases for '-fstack-protector-strong'.
@ -6,7 +11,7 @@
2013-05-07 Ian Bolton <ian.bolton@arm.com>
* gcc.target/aarch64/ands_1.c: New test.
* gcc.target/aarch64/ands_1.c: New test.
* gcc.target/aarch64/ands_2.c: Likewise
2013-05-07 Christophe Lyon <christophe.lyon@linaro.org>

View File

@ -0,0 +1,9 @@
// PR c++/51226
// { dg-do compile { target c++11 } }
template<int> struct A // { dg-error "provided" }
{
enum E : int;
};
template<> enum A<>::E : int {} // { dg-error "wrong number|expected" }