Issue |
150340
|
Summary |
clang incorrectly allows converting function pointers to and from void* in constant expressions
|
Labels |
clang:frontend,
constexpr
|
Assignees |
|
Reporter |
efriedma-quic
|
Consider:
```
void f();
constexpr auto p1 = (void*)f;
constexpr auto p2 = (void(*)())p1;
```
clang currently accepts, but these should be rejected. [expr.const] says an _expression_ is not a constant _expression_ if it contains a reinterpret_cast ... and converting a function pointer to an object pointer requires a reinterpret_cast.
gcc rejects, MSVC accepts p1.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs