gcc/testsuite/g++.dg/concepts/placeholder5.C
raw| 1 | // { dg-do compile { target c++17 } } |
| 2 | // { dg-options "-fconcepts" } |
| 3 | |
| 4 | template <class T, class U> |
| 5 | concept Same = __is_same_as(T, U); |
| 6 | |
| 7 | const int i = 0; |
| 8 | template <class T> |
| 9 | concept C = |
| 10 | requires { |
| 11 | { &i } -> const Same<T>*; // { dg-error "not a plain type-constraint" } |
| 12 | }; |
| 13 | |
| 14 | template <C c> |
| 15 | constexpr bool f() { return true; } |
| 16 | |
| 17 | static_assert(f<double>(), ""); // { dg-error "no match" } |
| 18 | static_assert(f<int>(), ""); // { dg-error "no match" } |