1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9
10// <unordered_set>
11
12// Check that std::unordered_set fails to instantiate if the comparison predicate is
13// not copy-constructible. This is LWG issue 2436
14
15#include <unordered_set>
16
17template <class T>
18struct Comp {
19 bool operator () (const T& lhs, const T& rhs) const { return lhs == rhs; }
20
21 Comp () {}
22private:
23 Comp (const Comp &); // declared but not defined
24 };
25
26
27int main(int, char**) {
28 std::unordered_set<int, std::hash<int>, Comp<int> > m;
29
30 return 0;
31}
32

source code of libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/compare_copy_constructible.compile.fail.cpp