gcc/testsuite/g++.dg/cpp2a/concepts-fn8.C
raw| 1 | // PR c++/111703 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | template<class T> |
| 5 | constexpr bool always_true() { return true; } |
| 6 | |
| 7 | struct P { |
| 8 | P() = default; |
| 9 | |
| 10 | template<class T> |
| 11 | requires (always_true<T>()) // { dg-bogus "used before its definition" } |
| 12 | constexpr P(const T&) { } |
| 13 | |
| 14 | int n, m; |
| 15 | }; |
| 16 | |
| 17 | void (*f)(P); |
| 18 | P (*h)(P); |
| 19 | |
| 20 | template<class T> |
| 21 | constexpr bool g() { |
| 22 | P x; |
| 23 | f(x); // { dg-bogus "from here" } |
| 24 | f(h(x)); // { dg-bogus "from here" } |
| 25 | return true; |
| 26 | } |