Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/concepts/equiv.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 // { dg-options "-std=c++17 -fconcepts" } | |
2 | |
3 // Check equivalence of short- and longhand declarations. | |
4 | |
5 template<typename T> | |
6 concept bool C() { return __is_class(T); } | |
7 | |
8 template<typename T> | |
9 concept bool D() { return __is_empty(T); } | |
10 | |
11 struct X { } x; | |
12 | |
13 void f1(C x); | |
14 template<C T> void f2(T x); | |
15 void f3(C x); | |
16 template<C T> void f4(T x) requires D<T>(); | |
17 template<C T> void f5(T x) requires D<T>(); | |
18 template<C T> void f6(T x) requires D<T>(); | |
19 | |
20 int main() { | |
21 f1(x); | |
22 f2(x); | |
23 f3(x); | |
24 f4(x); | |
25 f5(x); | |
26 f6(x); | |
27 } | |
28 | |
29 template<typename T> requires C<T>() void f1(T x) { } | |
30 template<typename T> requires C<T>() void f2(T x) { } | |
31 template<C T> void f3(T x) { } | |
32 template<typename T> requires C<T>() void f4(T x) requires D<T>() { } | |
33 template<typename T> requires C<T>() and D<T>() void f5(T x) { } | |
34 template<typename T> void f6(T x) requires C<T>() and D<T>() { } |