diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/concepts/intro2.C')
-rw-r--r-- | gcc/testsuite/g++.dg/concepts/intro2.C | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/concepts/intro2.C b/gcc/testsuite/g++.dg/concepts/intro2.C new file mode 100644 index 00000000000..91a1cacf9c0 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/intro2.C @@ -0,0 +1,27 @@ +// { dg-do run } +// { dg-options "-std=c++1z" } + +#include <cassert> + +template<typename T> + concept bool C() { return __is_class(T); } + +template<int N> + concept bool P() { return true; } + +C{A} struct S1 +{ + P{B} int f1(); +}; + +struct S2 {}; + +int main() +{ + S1<S2> s; + + assert(s.f1<10>() == sizeof(S2) + 10); + return 0; +} + +C{A} P{B} int S1<A>::f1() { return B + sizeof(A); } |