aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts5.C
blob: ed8028f8540be6bfd1fecbacad4729509700d2a9 (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
// { dg-do compile { target c++20 } }


template <typename T, typename U>
concept same_as = __is_same_as(T, U);

template<typename T>
concept character = same_as<T, char>;

struct T
{
  constexpr T(same_as<int> auto const x) : val(0) { }

  constexpr T(character auto const x) : val(1) { }

  int val;
};

void test()
{
  static_assert(T(0).val == 0);
  static_assert(T('a').val == 1);
}