Skip to content

clang accepts 'enum struct' in C mode with warning despite being unusable #42372

@llvmbot

Description

@llvmbot
Bugzilla Link 43027
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @WonHoYoo,@DougGregor,@garfr,@zygoloid

Extended Description

In C mode, Clang accepts this code with a warning:

enum struct Foo {
A
};

However, it is useless. None of the members seem to be accessible.

I've tried typedefs, ::, :, ., ->, casts, but nothing seems to allow me to access A.

Either these should be allowed as a documented extension with ::, or treated as a syntax error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillacclang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerclang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions