Issue 129213
Summary Clang 10 Incorrectly Accepts Invalid Enum Base Type Syntax enum class a : int b;
Labels clang
Assignees
Reporter starbugs-qurong
    Clang 10 erroneously compiles code containing an invalid enum base type declaration (enum class a : int b;), while MSVC/GCC correctly reject it. This violates the C++ standard syntax rules.

For  the following code test.cpp:

```
template <typename T> 
void qux() {
    enum class a : int b; // Invalid syntax
}

int main() {
    qux<int>();
    return 0;
}
```
Compile with Clang 10:
clang++ -std=c++11 test.cpp
Expected Result:
Compilation fails with a syntax error (as in MSVC/GCC).

Actual Result:
Clang 10 compiles the code without errors.

Environment:
Compiler: Clang 10.0.0
Flags: -std=c++11

Compiler Explorer link: https://godbolt.org/z/P3sa4EKhd 
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to