-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partyinvalid-code-generationTool (e.g. clang-format) produced invalid code that no longer compilesTool (e.g. clang-format) produced invalid code that no longer compiles
Description
Link.
Code:
[[nodiscard]] enum class E1 {};
enum [[nodiscard]] class E2 {};
Error:
<source>:1:19: error: misplaced attributes; expected attributes here
1 | [[nodiscard]] enum class E1 {};
| ~~~~~~~~~~~~~ ^
| [[nodiscard]]
<source>:3:6: error: an attribute list cannot appear here
3 | enum [[nodiscard]] class E2 {};
| ^~~~~~~~~~~~~
For E1
, clang says to put [[nodiscard]]
after the enum
keyword, but if you do that, it errors on not being valid there either.
My guess is that works with old enum
s, but was not tested with enum class
.
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partyinvalid-code-generationTool (e.g. clang-format) produced invalid code that no longer compilesTool (e.g. clang-format) produced invalid code that no longer compiles