summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/concepts/class6.C
blob: 29dcb8ff97e6f07ec39dfc8407b4e82185e42693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// { dg-options "-std=c++17 -fconcepts" }

template<typename T>
  concept bool One() { return sizeof(T) >= 4; }

template<typename T>
  concept bool Two() { return One<T>() && sizeof(T) >= 8; }

// Check that there is no ecsacpe hatch
template<Two T> struct S4 { };
template<One T> struct S4<T> { }; // { dg-error "does not specialize" }

struct one_type { char x[4]; };

// Constraints are checked even when decls are not instantiatied.
S4<one_type>* x4b; // { dg-error "constraint|invalid" }

int main() { }