gcc/testsuite/g++.dg/cpp2a/concepts-ctad1.C
raw| 1 | // PR c++/98611 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | template <class T, class U> |
| 5 | concept IsSame = __is_same(T, U); |
| 6 | |
| 7 | template <class T, template <class...> class _Class> |
| 8 | concept IsInstantiationOf = requires(T object) { |
| 9 | { _Class{object} } -> IsSame<T>; |
| 10 | }; |
| 11 | |
| 12 | template <class T> struct Degrees {}; |
| 13 | static_assert(IsInstantiationOf<Degrees<int>, Degrees>); |
| 14 | |
| 15 | template <class T> struct NotDegrees {}; |
| 16 | static_assert(!IsInstantiationOf<Degrees<int>, NotDegrees>); |