2 // { dg-options "-std=c++17 -fconcepts" }
4 // Test that constraint satisfaction checks work even when
5 // processing template declarations.
14 auto begin(T& t) -> decltype(t.begin()) { return t.begin(); }
17 auto begin(T const& t) -> decltype(t.begin()) { return t.begin(); }
20 auto end(T& t) -> decltype(t.end()) { return t.end(); }
23 auto end(T const& t) -> decltype(t.end()) { return t.end(); }
31 return __is_same_as( T, float );
35 constexpr decltype(auto) project( T t )
41 concept bool Concept()
43 return requires( T t ) {
44 requires Float<decltype( project(t) )>();
48 template <Concept E, Concept F>
49 constexpr decltype(auto) operator<<( E&& e, F&& f ) {}
54 // Try to resolve operator<< from within a template context but
55 // with non-dependent arguments. We need to ensure that template
56 // processing is turned off whenever checking for satisfaction.
57 std::cout << "OK"; // { dg-error "no match" }
64 return requires( R r ) {
65 requires __is_same_as(
66 decltype(std::begin(r)), decltype(std::end(r)) );
73 A( const A& ) = default;
75 // Derivation from this class forces the instantiation of
76 // this constructor, which results in the __is_same_as type
77 // trait above to become error_mark_node in this declaration.
79 explicit A( R&& r ) { }
85 C( const C& ) = default;