https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89599
Bug ID: 89599 Summary: C-style function-pointer-to-void* cast is handled inconsistently Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jandemooij+gccbugs at gmail dot com Target Milestone: --- When compiling the code below with GCC 8.3.0 or 9, GCC reports an error: <source>:5:30: error: a reinterpret_cast is not a constant expression 5 | static constexpr void* ptr = (void*)&func1; | ^~~~~~~~~~~~~ However shouldn't it also report an error for the |arr| version? https://godbolt.org/z/KeEH-2 ------- void func1(int x) {} void func2(char z, bool b) {} static constexpr void* arr[2] = {(void*)&func1, (void*)func2}; static constexpr void* ptr = (void*)&func1; int main() { return 0; }