1 // PR c++/91428 - warn about std::is_constant_evaluated in if constexpr.
2 // { dg-do compile { target c++20 } }
3 // { dg-options "-Wtautological-compare" }
7 is_constant_evaluated () noexcept
9 return __builtin_is_constant_evaluated ();
16 if constexpr (std::is_constant_evaluated ()) // { dg-warning ".std::is_constant_evaluated. always evaluates to true in .if constexpr." }
25 if constexpr (__builtin_is_constant_evaluated ()) // { dg-warning ".std::is_constant_evaluated. always evaluates to true in .if constexpr." }
34 // I is not a constant expression but we short-circuit it.
35 if constexpr (__builtin_is_constant_evaluated () || i) // { dg-warning ".std::is_constant_evaluated. always evaluates to true in .if constexpr." }
45 if constexpr (j && __builtin_is_constant_evaluated ()) // { dg-warning ".std::is_constant_evaluated. always evaluates to true in .if constexpr." }