OSDN Git Service

PR c++/47277
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 May 2011 19:32:14 +0000 (19:32 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 May 2011 19:32:14 +0000 (19:32 +0000)
* parser.c (cp_parser_unqualified_id): Don't check
constructor_name_p for enums.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174355 138bc75d-0d04-0410-961f-82ee72b054a4

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

index edc1421..7a579c6 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 135ab14..a16ba89 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 841a202..319fc28 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 "" }
+}