https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111122
Bug ID: 111122 Summary: local temps from get_nsdmi -> break_out_target_exprs break constexpr evaluation Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target Milestone: --- struct T { const char *d = new char[2] { 'o', 'k' }; constexpr int size () const { return 2; } constexpr const char *data () const { return d; } constexpr ~T () { delete[] d; } }; constexpr int a = T{}.size (); constexpr int b = T{}.data ()[0]; //constexpr const char *c = T{}.data (); is rejected by g++ with test42.C:7:29: error: the value of ‘<anonymous>’ is not usable in a constant expression 7 | constexpr int a = T{}.size (); | ^ test42.C:7:21: note: ‘<anonymous>’ was not declared ‘constexpr’ 7 | constexpr int a = T{}.size (); | ^ test42.C:8:32: error: the value of ‘<anonymous>’ is not usable in a constant expression 8 | constexpr int b = T{}.data ()[0]; | ^ test42.C:8:21: note: ‘<anonymous>’ was not declared ‘constexpr’ 8 | constexpr int b = T{}.data ()[0]; | ^ during potential_constant_expression_1, while clang++ accepts it.