https://bugs.llvm.org/show_bug.cgi?id=38235
Bug ID: 38235
Summary: attribute((constructor)) accepts enum class as integer
constan
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangb...@nondot.org
Reporter: zhong...@pku.org.cn
CC: dgre...@apple.com, llvm-bugs@lists.llvm.org
The code is as follow:
enum class E : int { prio = 666 };
void f (int) __attribute__((constructor(E::prio)));
It is accepted by clang++ whereas the conversion should require an explicit
cast. default_conversion -> decay_conversion -> decl_constant_value_safe
returns:
<integer_cst 0x7ffff662efc0 type <enumeral_type 0x7ffff6624b28 E> constant 666>
and we then accept any integer_cst.
Instead, g++ rejects the code:
error: constructor priorities must be integers from 0 to 65535 inclusive
void f (int) __attribute__((constructor(E::prio)));
^
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs