summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/concepts/fn3.C
blob: 06402e02c3bbab6d9b22144415d1b30f943a9a6d (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
// { dg-do run }
// { dg-options "-std=c++1z" }

#include <cassert>

// Check partial ordering during overload resolution.

template<typename T>
  concept bool C() { return __is_class(T); }

template<typename T>
  concept bool D() { return C<T>() and __is_empty(T); }

struct S1 { } s1;
struct S2 { int n; } s2;

int called = 0;

template<C T> void f1(T x) { called = 1;}
template<D T> void f1(T x) { called = 2;}

int main() {
  f1(s1); assert(called == 2);
  f1(s2); assert(called == 1);
}