llvm-project/clang/test/SemaCXX/constexpr-if.cpp
Oleksandr T. bfdeb58730
[Clang] use constant evaluation context for constexpr if conditions (#123667)
Fixes #123524

---

This PR addresses the issue of immediate function expressions not
properly evaluated in `constexpr` if conditions. Adding the
`ConstantEvaluated` context for expressions in `constexpr` if statements
ensures that these expressions are treated as manifestly
constant-evaluated and parsed correctly.
2025-03-10 01:53:20 +02:00

13 lines
296 B
C++

// RUN: %clang_cc1 -std=c++20 -verify=cxx20,expected %s
// RUN: %clang_cc1 -std=c++23 -verify=cxx23,expected %s
// RUN: %clang_cc1 -std=c++26 -verify=cxx26,expected %s
// expected-no-diagnostics
namespace GH123524 {
consteval void fn1() {}
void fn2() {
if constexpr (&fn1 != nullptr) { }
}
}