blob: 38933e4cf091c6cb437b52d74081efacc837eabb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// { dg-options "-std=c++17 -fconcepts" }
#include <vector>
using namespace std;
template<typename T>
struct Sequence : std::false_type { };
template<typename T>
struct Predicate : std::false_type { };
template<typename Seq, typename Fn>
requires Sequence<Seq>{} and Predicate<Fn>{}
bool all(const Seq& seq, Fn fn) {
for(const auto& x : seq)
if (not fn(x))
return false;
return true;
}
int main() {
all(vector<int>{0, 2}, true); // { dg-error "not|bool" }
}
|