Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/concepts-partial-spec6.C

raw
1 // PR c++/67152
2 // { dg-do compile { target c++20 } }
3
4 template <class T>
5 concept HasType = requires { typename T::type; };
6
7 template<class T>
8 struct trait {
9 using type = void;
10 };
11
12 struct has_type { using type = void; };
13
14 // Instantiation here
15 trait<has_type>::type foo() {}
16
17 // constrained version here. Type "has_type" would fail this
18 // constraint so this partial specialization would not have been
19 // selected.
20 template<class T>
21 requires (!HasType<T>)
22 struct trait<T> {
23 using type = void;
24 };