<div dir="ltr">Hi all,<div><br></div><div>I'm new to Clang, and decided that I want to implement a small C++20 feature - the "using enum" proposal (<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1099r5.html">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1099r5.html</a>).</div><div><br></div><div>The first part of the proposal, supporting syntax such as "using Color::RED" is easy enough to implement, and basically requires removing an if-statement and adding some diagnostics.</div><div><br></div><div>However, I struggle finding the correct way to implement the "using enum Color" syntax. There are two approaches that I see when trying to implement it.</div><div><br></div><div>The first approach is "expanding" it to a list of using-declarations (i.e "using enum Color" would be equivalent to "using Color::RED, Color::BLUE, ...). This approach is easier to implement, however the resulting AST won't be as accurate.</div><div><br></div><div>The second approach is creating a new AST node representing a "UsingEnumDecl". This will generate a more "correct" AST, however it is much more complicated to implement - it is more similar to using directives ("using namespace ns"), whose implementation is complicated and heavily affects the name lookup.</div><div><br></div><div>What do you think is the correct way to implement the feature? Is reducing the complexity worth degrading the accuracy of the AST?</div><div><br></div><div>Thanks,</div><div>Shachaf</div></div>