aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts-pr69235.C
blob: 2b5d012ade6244c2db06dd1228943171cf52e2db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts" }

template<typename T>
concept Boolean =
  requires(T t)
  {
    { t } -> bool; // { dg-error "return-type-requirement is not a type-constraint" }
  };


template<typename T>
concept C =
  requires (T t)
  {
    { t } -> Boolean;
  };


template<typename T>
struct X;

template<typename T>
  requires (! C<typename T::type>)
struct X<T>
{
  using type = int;
};

template<typename T>
  requires C<typename T::type>
struct X<T>
{
  using type = int;
};

struct S
{
  using type = char;
};

void f()
{
  X<S>::type x;
}