From 488025c316ed7a54c205a977a7aeac51b187e176 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Sun, 10 May 2015 13:35:00 +0000 Subject: Fix for LWG Issue 2059: C++0x ambiguity problem with map::erase git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@236950 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../unord/unord.multiset/erase_const_iter.pass.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp') diff --git a/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp b/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp index 6a005d3e3..d3be2b6d6 100644 --- a/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp +++ b/test/std/containers/unord/unord.multiset/erase_const_iter.pass.cpp @@ -20,6 +20,15 @@ #include "min_allocator.h" +struct TemplateConstructor +{ + template + TemplateConstructor (const T&) {} +}; + +bool operator==(const TemplateConstructor&, const TemplateConstructor&) { return false; } +struct Hash { size_t operator() (const TemplateConstructor &) const { return 0; } }; + int main() { { @@ -67,4 +76,18 @@ int main() assert(c.count(4) == 1); } #endif +#if __cplusplus >= 201402L + { + // This is LWG #2059 + typedef TemplateConstructor T; + typedef std::unordered_set C; + typedef C::iterator I; + + C m; + T a{0}; + I it = m.find(a); + if (it != m.end()) + m.erase(it); + } +#endif } -- cgit v1.2.3