comparison gcc/testsuite/g++.dg/concepts/class4.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 template<typename T>
4 concept bool Class() { return __is_class(T); }
5
6 template<typename T>
7 concept bool Union() { return __is_union(T); }
8
9 // Check non-overlapping specializations
10 template<typename T> struct S1 { static const int value = 0; };
11 template<Class T> struct S1<T> { static const int value = 1; };
12 template<Union T> struct S1<T> { static const int value = 2; };
13
14 struct S { };
15 union U { };
16
17 static_assert(S1<int>::value == 0, "");
18 static_assert(S1<S>::value == 1, "");
19 static_assert(S1<U>::value == 2, "");
20
21 int main() { }