Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/concepts/intro2.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-do run } | |
2 // { dg-options "-std=c++17 -fconcepts" } | |
3 | |
4 #include <cassert> | |
5 | |
6 template<typename T> | |
7 concept bool C() { return __is_class(T); } | |
8 | |
9 template<int N> | |
10 concept bool P() { return true; } | |
11 | |
12 C{A} struct S1 | |
13 { | |
14 P{B} int f1(); | |
15 }; | |
16 | |
17 struct S2 {}; | |
18 | |
19 int main() | |
20 { | |
21 S1<S2> s; | |
22 | |
23 assert(s.f1<10>() == sizeof(S2) + 10); | |
24 return 0; | |
25 } | |
26 | |
27 C{A} P{B} int S1<A>::f1() { return B + sizeof(A); } |