1 // { dg-do compile { target c++17 } } 2 // { dg-options "-fconcepts" } 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> Streamable()11concept bool Streamable() 12 { 13 return requires (T t) { t; }; 14 } 15 16 template<typename T> Range()17concept bool Range() 18 { 19 return requires (T t) { t; }; 20 } 21 22 template<class T> 23 requires Streamable<T>() and not Range<T>() print(const T & x)24void print(const T& x) { } 25 main()26int main() 27 { 28 print("hello"); // { dg-error "cannot call" } 29 } 30