Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/concepts-pr69235.C

raw
1 // { dg-do compile { target c++20 } }
2 // { dg-additional-options "-fconcepts" }
3
4 template<typename T>
5 concept Boolean =
6 requires(T t)
7 {
8 { t } -> bool; // { dg-error "return-type-requirement is not a type-constraint" }
9 };
10
11
12 template<typename T>
13 concept C =
14 requires (T t)
15 {
16 { t } -> Boolean;
17 };
18
19
20 template<typename T>
21 struct X;
22
23 template<typename T>
24 requires (! C<typename T::type>)
25 struct X<T>
26 {
27 using type = int;
28 };
29
30 template<typename T>
31 requires C<typename T::type>
32 struct X<T>
33 {
34 using type = int;
35 };
36
37 struct S
38 {
39 using type = char;
40 };
41
42 void f()
43 {
44 X<S>::type x;
45 }
46