https://bugs.llvm.org/show_bug.cgi?id=42203
Bug ID: 42203
Summary: clang accepts invalid code
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
My clang is 9.0.0, and the code is:
enum class A : unsigned long long {
z = (unsigned long long)-1
};
const A c{ A::z };
template <enum A : unsigned long long > struct Q {};
Q<c> j;
clang accepts the code. ICC rejects it:
<source>(5): error: an opaque enum declaration cannot be part of another
declaration
template <enum A : unsigned long long > struct Q {};
^
<source>(6): error: argument of type "A" is incompatible with template
parameter of type "A"
Q<c> j;
^
compilation aborted for <source> (code 2)
Compiler returned: 2
gcc also rejects it:
<source>:5:39: error: expected ';' or '{' before '>' token
5 | template <enum A : unsigned long long > struct Q {};
| ^
<source>:5:39: error: expected class-key before '>' token
<source>:6:4: note: invalid template non-type parameter
6 | Q<c> j;
| ^
Compiler returned: 1
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs