Implement LWG#2436: 'Comparators for associative containers should always be CopyConstructible'

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274235 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Marshall Clow
2016-06-30 15:11:53 +00:00
parent 3e9545e035
commit 0c99f18af4
15 changed files with 355 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <map>
// Check that std::multimap fails to instantiate if the comparison predicate is
// not copy-constructible. This is LWG issue 2436
#include <map>
template <class T>
struct Comp {
bool operator () (const T& lhs, const T& rhs) const { return lhs < rhs; }
Comp () {}
private:
Comp (const Comp &); // declared but not defined
};
int main() {
std::multimap<int, int, Comp<int> > m;
}