https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93955
Bug ID: 93955 Summary: detect conversion from pointer type to arithmetic type in constexpr Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- constexpr long int foo () { return (long int) "foo" #ifdef FOO - 1 #endif ; } constexpr long int l = foo (); is currently accepted with -DFOO but rejected otherwise. It should be rejected even in the -DFOO case: converting a pointer to an integral type must be done via a reinterpret_cast and that can't be part of a core constant expression.