gcc/testsuite/g++.dg/cpp2a/concepts-pr122494.C
raw| 1 | // PR c++/122494 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | template<class T> |
| 5 | concept C = false; |
| 6 | |
| 7 | template<class T> requires (!C<T>) |
| 8 | struct A { |
| 9 | static constexpr unsigned v = 0; |
| 10 | }; |
| 11 | |
| 12 | template<class T> |
| 13 | struct B { |
| 14 | static constexpr unsigned v = A<T>::v; |
| 15 | |
| 16 | constexpr static bool f() { |
| 17 | return [](auto) { |
| 18 | if (v == 0) { } |
| 19 | return true; |
| 20 | }(0); |
| 21 | } |
| 22 | }; |
| 23 | |
| 24 | static_assert(B<int>::f()); |