gcc/testsuite/g++.dg/cpp2a/concepts-conv2.C
raw| 1 | // PR c++/94597 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | template <typename b, typename c> concept d = requires(b e) { e.operator c(); }; |
| 5 | |
| 6 | template <typename f, typename g> requires(d<f, g>) bool equal(f, g); |
| 7 | |
| 8 | template <typename h> struct i { |
| 9 | i(h); |
| 10 | operator h(); |
| 11 | }; |
| 12 | |
| 13 | static_assert( d<i<float>, float>); |
| 14 | static_assert(!d<i<float>, int>); |
| 15 | |
| 16 | bool fun() { |
| 17 | i a(2.0f); |
| 18 | return equal(a, 3.0f); |
| 19 | } |