PR c++/83273 - constexpr if allows non-constant condition
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1z / constexpr-if12.C
blobdb984a6467774faf0d2349f79a8372bedc2a2823
1 // PR c++/80562
2 // { dg-options -std=c++17 }
4 struct T {
5   constexpr auto foo() { return false; }
6 };
8 template <class MustBeTemplate>
9 constexpr auto bf(T t) {
10     if constexpr(t.foo()) {     // { dg-error "constant expression" }
11         return false;
12     }
13     return true;