diff options
author | Patrick Palka <ppalka@gcc.gnu.org> | 2016-04-26 22:24:43 +0000 |
---|---|---|
committer | Patrick Palka <ppalka@gcc.gnu.org> | 2016-04-26 22:24:43 +0000 |
commit | 843ce8abafc0ba4ff7e15588c9713a784a771f0d (patch) | |
tree | 89e4c1f9086d639dff4c482b7ed34eea53576798 /gcc/cp/parser.c | |
parent | 3866f82f5847a4bb81a98a18ec7480fefacba74a (diff) | |
download | gcc-843ce8abafc0ba4ff7e15588c9713a784a771f0d.zip gcc-843ce8abafc0ba4ff7e15588c9713a784a771f0d.tar.gz gcc-843ce8abafc0ba4ff7e15588c9713a784a771f0d.tar.bz2 |
Fix PR c++/70241 (inconsistent access with in-class enumeration)
gcc/cp/ChangeLog:
PR c++/70241
* decl.c (build_enumerator): Set current_access_specifier when
declaring an enumerator belonging to an in-class enumeration.
* parser.c (cp_parser_check_access_in_redecleration): Also
consider in-class enumerations.
gcc/testsite/ChangeLog:
PR c++/70241
* g++.dg/cpp0x/enum32.C: New test.
* g++.dg/cpp0x/enum33.C: New test.
From-SVN: r235456
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 500a9b3..2dcb766 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -27238,13 +27238,15 @@ cp_parser_check_class_key (enum tag_types class_key, tree type) /* Issue an error message if DECL is redeclared with different access than its original declaration [class.access.spec/3]. - This applies to nested classes and nested class templates. - [class.mem/1]. */ + This applies to nested classes, nested class templates and + enumerations [class.mem/1]. */ static void cp_parser_check_access_in_redeclaration (tree decl, location_t location) { - if (!decl || !CLASS_TYPE_P (TREE_TYPE (decl))) + if (!decl + || (!CLASS_TYPE_P (TREE_TYPE (decl)) + && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE)) return; if ((TREE_PRIVATE (decl) |