[llvm-bugs] [Bug 52403] Compile fails when using enum declaration

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 4 09:52:38 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52403

Aaron Ballman <aaron at aaronballman.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CONFIRMED                   |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Aaron Ballman <aaron at aaronballman.com> ---
Oops, I jumped the gun on confirming this. Sorry for the confusion!

I think Clang is correct to reject this code. http://eel.is/c++draft/enum.udecl
says that the production needs to parse an elaborated-enum-specifier. One of
the requirements for a valid elaborated-enum-specifier is that the elaboration
has to agree in kind with the given declaration
(https://eel.is/c++draft/dcl.type.elab#6). In this case, the given declaration
is not an enum, it's a type alias.

You can see that all compilers agree that `enum Hog` is an invalid elaborated
type specifier outside of a using enum declaration:
https://godbolt.org/z/MY7PbqbhK

Because it's not a valid elaborated-type-specifier, I think GCC and MSVC are
incorrect to accept this code.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211104/9efe014e/attachment.html>


More information about the llvm-bugs mailing list