diff options
author | Marek Polacek <polacek@redhat.com> | 2016-04-21 16:52:51 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2016-04-21 16:52:51 +0000 |
commit | aedf4e122b56aa6bf977e42adf198b49511aa0f3 (patch) | |
tree | 51b762e91374034a2271b2b44fec2c9b02116a91 /gcc/cp | |
parent | 2074d80a607e13d3e18b550ae66e7c3be5135d4a (diff) | |
download | gcc-aedf4e122b56aa6bf977e42adf198b49511aa0f3.zip gcc-aedf4e122b56aa6bf977e42adf198b49511aa0f3.tar.gz gcc-aedf4e122b56aa6bf977e42adf198b49511aa0f3.tar.bz2 |
re PR c++/70513 (ICE on invalid C++ code on x86_64-linux-gnu: Segmentation fault)
PR c++/70513
* parser.c (cp_parser_enum_specifier): Check and possibly error for
extra qualification.
* g++.dg/cpp0x/forw_enum12.C: New test.
* g++.dg/cpp0x/forw_enum13.C: New test.
From-SVN: r235347
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 10 |
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 50f3cc3..8efaa80 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-04-21 Marek Polacek <polacek@redhat.com> + + PR c++/70513 + * parser.c (cp_parser_enum_specifier): Check and possibly error for + extra qualification. + 2016-04-20 Nathan Sidwell <nathan@acm.org> PR c++/55635 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 0a1ed1a..feb8de7 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17233,6 +17233,16 @@ cp_parser_enum_specifier (cp_parser* parser) type, prev_scope, nested_name_specifier); type = error_mark_node; } + /* If that scope is the scope where the declaration is being placed + the program is invalid. */ + else if (CLASS_TYPE_P (nested_name_specifier) + && CLASS_TYPE_P (prev_scope) + && same_type_p (nested_name_specifier, prev_scope)) + { + permerror (type_start_token->location, + "extra qualification not allowed"); + nested_name_specifier = NULL_TREE; + } } if (scoped_enum_p) |