re PR c++/47277 ([C++0x] pseudo destructor code that cause an internal compiler error...
authorJason Merrill <jason@redhat.com>
Fri, 27 May 2011 19:32:14 +0000 (15:32 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 27 May 2011 19:32:14 +0000 (15:32 -0400)
PR c++/47277
* parser.c (cp_parser_unqualified_id): Don't check
constructor_name_p for enums.

From-SVN: r174355

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/enum18.C [new file with mode: 0644]

index edc14219e61cafafe0394964f2b86991498d31c3..7a579c6d004e4f911678e320ef1c8ba3c7af7c90 100644 (file)
@@ -1,5 +1,9 @@
 2011-05-27  Jason Merrill  <jason@redhat.com>
 
+       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.
 
index 135ab145fb86989544acedbd061ec61ff467155c..a16ba89e36465dcb696d3659819d6516c7d3a47e 100644 (file)
@@ -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);
index 841a2023d882033e25215ad1433544d7c64408d6..319fc28e05981c81f9d56c71c3973bd2f57eb628 100644 (file)
@@ -1,5 +1,7 @@
 2011-05-27  Jason Merrill  <jason@redhat.com>
 
+       * 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 (file)
index 0000000..5575ca6
--- /dev/null
@@ -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 "" }
+}