summaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-26 21:39:48 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-03-26 21:39:48 +0000
commite221246baf59019a4a64f1ad8a1c75c5aa9cc0bd (patch)
tree283a2f977dca6f87bfaacc7659ae3cafb65b8a44 /gcc/cp/parser.c
parentee8f7e1483d36b9bce5f865fc2c37fb170f46b6e (diff)
downloadgcc-e221246baf59019a4a64f1ad8a1c75c5aa9cc0bd.tar.gz
PR c++/43509
* parser.c (cp_parser_qualifying_entity): Do accept enum names in c++0x mode, but not other type-names. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157765 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 41982f77cc9..693d6cd692e 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -4441,6 +4441,16 @@ cp_parser_qualifying_entity (cp_parser *parser,
/* Parse a typedef-name or enum-name. */
scope = cp_parser_nonclass_name (parser);
+
+ /* "If the name found does not designate a namespace or a class,
+ enumeration, or dependent type, the program is ill-formed."
+
+ We cover classes and dependent types above and namespaces below,
+ so this code is only looking for enums. */
+ if (!scope || TREE_CODE (scope) != TYPE_DECL
+ || TREE_CODE (TREE_TYPE (scope)) != ENUMERAL_TYPE)
+ cp_parser_simulate_error (parser);
+
successful_parse_p = cp_parser_parse_definitely (parser);
}
/* If that didn't work, try for a namespace-name. */