[clang] Clang accepts out-of-line definition of an enum member of a local class
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
[[class.local]/3](https://eel.is/c++draft/class.local#3) says that the only member of a local class that can be defined out-of-line is a nested class:
> A class nested within a local class is a local class. A member of a local class `X` shall be declared only in the definition of `X` or, if the member is a nested class, in the nearest enclosing block scope of X.
But Clang currently accepts out-of-line definitions for enums too:
```cpp
void f() {
class A { enum E : int; };
enum A::E : int {};
}
```
Granted, so do all other major implementations: https://godbolt.org/z/9GTEzsT8x, so maybe we should consider this a standard defect. If others agree, I could file a core issue for it. We'll also have to make sure we don't repeat #193472 for enums.
Contributor guide
Assessment
This issue has not been assessed yet.