diff options
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 7c34d94..ec47b06 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1331,6 +1331,23 @@ handle_using_decl (tree using_decl, tree t) add_method (t, *iter, true); alter_access (t, *iter, access); } + else if (USING_DECL_UNRELATED_P (using_decl)) + { + /* C++20 using enum can import non-inherited enumerators into class + scope. We implement that by making a copy of the CONST_DECL for which + CONST_DECL_USING_P is true. */ + gcc_assert (TREE_CODE (decl) == CONST_DECL); + + tree copy = copy_decl (decl); + DECL_CONTEXT (copy) = t; + DECL_ARTIFICIAL (copy) = true; + /* We emitted debug info for the USING_DECL above; make sure we don't + also emit anything for this clone. */ + DECL_IGNORED_P (copy) = true; + DECL_SOURCE_LOCATION (copy) = DECL_SOURCE_LOCATION (using_decl); + finish_member_declaration (copy); + DECL_ABSTRACT_ORIGIN (copy) = decl; + } else alter_access (t, decl, access); } |