131
|
1 // { dg-do compile { target c++17 } }
|
|
2 // { dg-options "-fconcepts" }
|
111
|
3
|
|
4 // Check that we can evaluate constant requires-expressions
|
|
5 // as constant expressions, for the curious case when they
|
|
6 // appear within predicate constraints.
|
|
7
|
|
8 template<typename... Ts> struct variant { };
|
|
9
|
|
10 template<typename T>
|
|
11 concept bool Streamable()
|
|
12 {
|
|
13 return requires (T t) { t; };
|
|
14 }
|
|
15
|
|
16 template<typename T>
|
|
17 concept bool Range()
|
|
18 {
|
|
19 return requires (T t) { t; };
|
|
20 }
|
|
21
|
|
22 template<class T>
|
|
23 requires Streamable<T>() and not Range<T>()
|
|
24 void print(const T& x) { }
|
|
25
|
|
26 int main()
|
|
27 {
|
|
28 print("hello"); // { dg-error "cannot call" }
|
|
29 }
|