Here f<int>() is not constexpr in C++20 (but is in C++23 after P2242R3) due to the local variable a of non-literal type A, so the testcase is invalid: struct A { ~A(); }; void g(); template<class T> constexpr int f() { if (__builtin_is_constant_evaluated()) return 42; g(); A a; } constexpr int n = f<int>(); But our diagnostic incorrectly blames the call to the non-constexpr g() for f<int>() being non-constexpr, rather than the variable a: constexpr-nonliteral.C:13:25: error: ‘constexpr int f() [with T = int]’ called in a constant expression 13 | constexpr int n = f<int>(); | ~~~~~~^~ constexpr-nonliteral.C:6:15: note: ‘constexpr int f() [with T = int]’ is not usable as a ‘constexpr’ function because: 6 | constexpr int f() { | ^ constexpr-nonliteral.C:9:4: error: call to non-‘constexpr’ function ‘void g()’ 9 | g(); | ~^~ constexpr-nonliteral.C:3:6: note: ‘void g()’ declared here 3 | void g(); | ^
Confirmed. there might be others like this too.