Debian Codegraph @

gcc/testsuite/g++.dg/modules/constrained-partial-1_a.C

raw
1 // { dg-additional-options "-fmodules-ts -std=c++20" }
2
3 export module M;
4 // { dg-module-cmi M }
5
6 export template <typename T0>
7 struct traits
8 {
9 static constexpr int variant = 0;
10 };
11
12 // #2
13 template <typename T2>
14 requires requires { typename T2::element_type; }
15 struct traits<T2 *>
16 {
17 using type = typename T2::element_type;
18 static constexpr int variant = 2;
19 };
20
21
22 // #1
23 template <typename T1>
24 struct traits<T1 *>
25 {
26 using type = T1;
27 static constexpr int variant = 1;
28 };
29
30
31 // #3
32 template <typename T3>
33 requires requires { typename T3::value_type; }
34 struct traits<T3 *>
35 {
36 using type = typename T3::value_type;
37 static constexpr int variant = 3;
38 };