diff options
| author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-26 21:39:48 +0000 |
|---|---|---|
| committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-03-26 21:39:48 +0000 |
| commit | e221246baf59019a4a64f1ad8a1c75c5aa9cc0bd (patch) | |
| tree | 283a2f977dca6f87bfaacc7659ae3cafb65b8a44 | |
| parent | ee8f7e1483d36b9bce5f865fc2c37fb170f46b6e (diff) | |
| download | ppe42-gcc-e221246baf59019a4a64f1ad8a1c75c5aa9cc0bd.tar.gz ppe42-gcc-e221246baf59019a4a64f1ad8a1c75c5aa9cc0bd.zip | |
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
| -rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
| -rw-r--r-- | gcc/cp/parser.c | 10 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/parse1.C | 5 |
4 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 81e97724d56..d790bfdaa09 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2010-03-26 Jason Merrill <jason@redhat.com> + + PR c++/43509 + * parser.c (cp_parser_qualifying_entity): Do accept enum names in + c++0x mode, but not other type-names. + 2010-03-26 Dodji Seketeli <dodji@redhat.com> PR c++/43327 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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c61e37c4622..3ed0e1c6a1f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-03-26 Jason Merrill <jason@redhat.com> + + PR c++/43509 + * g++.dg/cpp0x/parse1.C: New. + 2010-03-26 Uros Bizjak <ubizjak@gmail.com> PR target/43524 diff --git a/gcc/testsuite/g++.dg/cpp0x/parse1.C b/gcc/testsuite/g++.dg/cpp0x/parse1.C new file mode 100644 index 00000000000..41811853cd7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/parse1.C @@ -0,0 +1,5 @@ +// PR c++/43509 +// { dg-options "-std=c++0x" } + +typedef int B; // { dg-error "" } +B::B() {} // { dg-error "" } |

