Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
llvmbot opened this issue Aug 17, 2019 · 3 comments
Closed
Labels
bugzilla Issues migrated from bugzilla c clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 17, 2019

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.

@WonHoYoo
Copy link
Mannequin

WonHoYoo mannequin commented Dec 11, 2019

I guess the diagnose is for letting programmers know the C++11 features, so no problem at all.

I don't find any problem with the option -std=c++11.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
@AaronBallman AaronBallman added the confirmed Verified by a second party label May 5, 2022
@AaronBallman
Copy link
Collaborator

This is almost certainly a bug -- we're accepting scoped enumerations as a language extension but there's no way to access the enumeration constant by name.

@AaronBallman AaronBallman added clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer labels May 5, 2022
@llvmbot
Copy link
Collaborator Author

llvmbot commented May 5, 2022

@llvm/issue-subscribers-clang-frontend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c clang:diagnostics New/improved warning or error message in Clang, but not in clang-tidy or static analyzer clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party
Projects
None yet
Development

No branches or pull requests

2 participants