blob: bc0e126c96c88ae6e6caf1bf28daae9dc5424c27 (
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 { target c++17 } }
// { dg-options "-fconcepts" }
#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);
}
|