From 1fbbe7d6b21bcfd89b0d4722bb1f4b90c2b4965c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 27 May 2011 15:32:14 -0400 Subject: [PATCH] re PR c++/47277 ([C++0x] pseudo destructor code that cause an internal compiler error with std=gnu++0x) PR c++/47277 * parser.c (cp_parser_unqualified_id): Don't check constructor_name_p for enums. From-SVN: r174355 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/parser.c | 3 ++- gcc/testsuite/ChangeLog | 2 ++ gcc/testsuite/g++.dg/cpp0x/enum18.C | 8 ++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/enum18.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index edc14219e61..7a579c6d004 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2011-05-27 Jason Merrill + PR c++/47277 + * parser.c (cp_parser_unqualified_id): Don't check + constructor_name_p for enums. + PR c++/47687 * pt.c (dependent_type_p_r): Avoid infinite recursion. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 135ab145fb8..a16ba89e364 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -4069,7 +4069,8 @@ cp_parser_unqualified_id (cp_parser* parser, && (cp_lexer_peek_nth_token (parser->lexer, 2)->type != CPP_LESS) && (token->u.value == TYPE_IDENTIFIER (scope) - || constructor_name_p (token->u.value, scope))) + || (CLASS_TYPE_P (scope) + && constructor_name_p (token->u.value, scope)))) { cp_lexer_consume_token (parser->lexer); return build_nt (BIT_NOT_EXPR, scope); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 841a2023d88..319fc28e059 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-05-27 Jason Merrill + * g++.dg/cpp0x/enum18.C: New. + * g++.dg/cpp0x/lambda/lambda-nested4.C: New. * g++.dg/cpp0x/error6.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/enum18.C b/gcc/testsuite/g++.dg/cpp0x/enum18.C new file mode 100644 index 00000000000..5575ca6ce94 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/enum18.C @@ -0,0 +1,8 @@ +// PR c++/47277 +// { dg-options -std=c++0x } + +int main(void) { + enum e {}; + e ev; + ev.e::~e_u(); // { dg-error "" } +} -- 2.30.2