For the following program:
struct S { int i; };
constexpr S f() {
return std::is_constant_evaluated() ? S{1} : S{0};
}
int main() {
S s = f();
return s.i;
}
gcc returns 0, and clang returns 1. demo
I don't think the evaluation of f is being done in a context that requires constant evaluation, so I think clang is wrong here. Or is it the other way round? Or are both results valid?