Add tests for LWG#2299. While doing so, I noticed that the tests we have for the transparent comparators don't actually call them. Fix those tests, too. Now one of them is failing, due to a missing const in <map>. Add that (twice). Next step is to do the same for <unordered_map>

llvm-svn: 241091
This commit is contained in:
Marshall Clow 2015-06-30 18:15:41 +00:00
parent d9f09858a4
commit f8457a0735
50 changed files with 1718 additions and 3 deletions

View File

@ -1117,7 +1117,7 @@ public:
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
count(const _K2& __k) {return __tree_.__count_unique(__k);}
count(const _K2& __k) const {return __tree_.__count_unique(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
@ -1850,7 +1850,7 @@ public:
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type
count(const _K2& __k) {return __tree_.__count_multi(__k);}
count(const _K2& __k) const {return __tree_.__count_multi(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)

View File

@ -18,6 +18,7 @@
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
int main()
{
@ -133,6 +134,25 @@ int main()
assert(r == 1);
r = m.count(4);
assert(r == 0);
r = m.count(C2Int(5));
assert(r == 1);
r = m.count(C2Int(6));
assert(r == 1);
r = m.count(C2Int(7));
assert(r == 1);
r = m.count(C2Int(8));
assert(r == 1);
r = m.count(C2Int(9));
assert(r == 1);
r = m.count(C2Int(10));
assert(r == 1);
r = m.count(C2Int(11));
assert(r == 1);
r = m.count(C2Int(12));
assert(r == 1);
r = m.count(C2Int(4));
assert(r == 0);
}
{

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// XFAIL: c++03, c++11
// <map>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
int main()
{
typedef std::map<int, double, transparent_less> M;
M().count(C2Int{5});
}

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_no_type> M;
M().count(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_private> M;
M().count(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_not_a_type> M;
M().count(C2Int{5});
}
}
#endif

View File

@ -19,6 +19,7 @@
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
int main()
{
@ -365,6 +366,58 @@ int main()
r = m.equal_range(20);
assert(r.first == next(m.begin(), 8));
assert(r.second == next(m.begin(), 8));
r = m.equal_range(C2Int(5));
assert(r.first == next(m.begin(), 0));
assert(r.second == next(m.begin(), 1));
r = m.equal_range(C2Int(7));
assert(r.first == next(m.begin(), 1));
assert(r.second == next(m.begin(), 2));
r = m.equal_range(C2Int(9));
assert(r.first == next(m.begin(), 2));
assert(r.second == next(m.begin(), 3));
r = m.equal_range(C2Int(11));
assert(r.first == next(m.begin(), 3));
assert(r.second == next(m.begin(), 4));
r = m.equal_range(C2Int(13));
assert(r.first == next(m.begin(), 4));
assert(r.second == next(m.begin(), 5));
r = m.equal_range(C2Int(15));
assert(r.first == next(m.begin(), 5));
assert(r.second == next(m.begin(), 6));
r = m.equal_range(C2Int(17));
assert(r.first == next(m.begin(), 6));
assert(r.second == next(m.begin(), 7));
r = m.equal_range(C2Int(19));
assert(r.first == next(m.begin(), 7));
assert(r.second == next(m.begin(), 8));
r = m.equal_range(C2Int(4));
assert(r.first == next(m.begin(), 0));
assert(r.second == next(m.begin(), 0));
r = m.equal_range(C2Int(6));
assert(r.first == next(m.begin(), 1));
assert(r.second == next(m.begin(), 1));
r = m.equal_range(C2Int(8));
assert(r.first == next(m.begin(), 2));
assert(r.second == next(m.begin(), 2));
r = m.equal_range(C2Int(10));
assert(r.first == next(m.begin(), 3));
assert(r.second == next(m.begin(), 3));
r = m.equal_range(C2Int(12));
assert(r.first == next(m.begin(), 4));
assert(r.second == next(m.begin(), 4));
r = m.equal_range(C2Int(14));
assert(r.first == next(m.begin(), 5));
assert(r.second == next(m.begin(), 5));
r = m.equal_range(C2Int(16));
assert(r.first == next(m.begin(), 6));
assert(r.second == next(m.begin(), 6));
r = m.equal_range(C2Int(18));
assert(r.first == next(m.begin(), 7));
assert(r.second == next(m.begin(), 7));
r = m.equal_range(C2Int(20));
assert(r.first == next(m.begin(), 8));
assert(r.second == next(m.begin(), 8));
}
{
typedef PrivateConstructor PC;

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// XFAIL: c++03, c++11
// <map>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
int main()
{
typedef std::map<int, double, transparent_less> M;
M().equal_range(C2Int{5});
}

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_no_type> M;
M().equal_range(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_private> M;
M().equal_range(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_not_a_type> M;
M().equal_range(C2Int{5});
}
}
#endif

View File

@ -19,6 +19,7 @@
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
int main()
{
@ -200,6 +201,25 @@ int main()
assert(r == next(m.begin(), 7));
r = m.find(4);
assert(r == next(m.begin(), 8));
r = m.find(C2Int(5));
assert(r == m.begin());
r = m.find(C2Int(6));
assert(r == next(m.begin()));
r = m.find(C2Int(7));
assert(r == next(m.begin(), 2));
r = m.find(C2Int(8));
assert(r == next(m.begin(), 3));
r = m.find(C2Int(9));
assert(r == next(m.begin(), 4));
r = m.find(C2Int(10));
assert(r == next(m.begin(), 5));
r = m.find(C2Int(11));
assert(r == next(m.begin(), 6));
r = m.find(C2Int(12));
assert(r == next(m.begin(), 7));
r = m.find(C2Int(4));
assert(r == next(m.begin(), 8));
}
{

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// XFAIL: c++03, c++11
// <map>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
int main()
{
typedef std::map<int, double, transparent_less> M;
M().find(C2Int{5});
}

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_no_type> M;
M().find(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_private> M;
M().find(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_not_a_type> M;
M().find(C2Int{5});
}
}
#endif

View File

@ -19,6 +19,7 @@
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
int main()
{
@ -280,6 +281,41 @@ int main()
assert(r == next(m.begin(), 7));
r = m.lower_bound(20);
assert(r == next(m.begin(), 8));
r = m.lower_bound(C2Int(5));
assert(r == m.begin());
r = m.lower_bound(C2Int(7));
assert(r == next(m.begin()));
r = m.lower_bound(C2Int(9));
assert(r == next(m.begin(), 2));
r = m.lower_bound(C2Int(11));
assert(r == next(m.begin(), 3));
r = m.lower_bound(C2Int(13));
assert(r == next(m.begin(), 4));
r = m.lower_bound(C2Int(15));
assert(r == next(m.begin(), 5));
r = m.lower_bound(C2Int(17));
assert(r == next(m.begin(), 6));
r = m.lower_bound(C2Int(19));
assert(r == next(m.begin(), 7));
r = m.lower_bound(C2Int(4));
assert(r == next(m.begin(), 0));
r = m.lower_bound(C2Int(6));
assert(r == next(m.begin(), 1));
r = m.lower_bound(C2Int(8));
assert(r == next(m.begin(), 2));
r = m.lower_bound(C2Int(10));
assert(r == next(m.begin(), 3));
r = m.lower_bound(C2Int(12));
assert(r == next(m.begin(), 4));
r = m.lower_bound(C2Int(14));
assert(r == next(m.begin(), 5));
r = m.lower_bound(C2Int(16));
assert(r == next(m.begin(), 6));
r = m.lower_bound(C2Int(18));
assert(r == next(m.begin(), 7));
r = m.lower_bound(C2Int(20));
assert(r == next(m.begin(), 8));
}
{

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// XFAIL: c++03, c++11
// <map>
// class map
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
int main()
{
typedef std::map<int, double, transparent_less> M;
M().lower_bound(C2Int{5});
}

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_no_type> M;
M().lower_bound(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_private> M;
M().lower_bound(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_not_a_type> M;
M().lower_bound(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// XFAIL: c++03, c++11
// <map>
// class map
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
int main()
{
typedef std::map<int, double, transparent_less> M;
M().upper_bound(C2Int{5});
}

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_no_type> M;
M().upper_bound(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_private> M;
M().upper_bound(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::map<int, double, transparent_less_not_a_type> M;
M().upper_bound(C2Int{5});
}
}
#endif

View File

@ -18,6 +18,7 @@
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
int main()
{
@ -122,6 +123,21 @@ int main()
assert(r == 3);
r = m.count(10);
assert(r == 0);
r = m.count(C2Int(4));
assert(r == 0);
r = m.count(C2Int(5));
assert(r == 3);
r = m.count(C2Int(6));
assert(r == 0);
r = m.count(C2Int(7));
assert(r == 3);
r = m.count(C2Int(8));
assert(r == 0);
r = m.count(C2Int(9));
assert(r == 3);
r = m.count(C2Int(10));
assert(r == 0);
}
{

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// XFAIL: c++03, c++11
// <map>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
int main()
{
typedef std::multimap<int, double, transparent_less> M;
M().count(C2Int{5});
}

View File

@ -0,0 +1,37 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;
M().count(C2Int{5});
}
#endif

View File

@ -0,0 +1,37 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
typedef std::multimap<int, double, transparent_less_private> M;
M().count(C2Int{5});
}
#endif

View File

@ -0,0 +1,37 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;
M().count(C2Int{5});
}
#endif

View File

@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
// <map>
// <multimap>
// class multimap
@ -19,6 +19,7 @@
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
int main()
{
@ -219,6 +220,28 @@ int main()
r = m.equal_range(10);
assert(r.first == m.end());
assert(r.second == m.end());
r = m.equal_range(C2Int(4));
assert(r.first == m.begin());
assert(r.second == m.begin());
r = m.equal_range(C2Int(5));
assert(r.first == m.begin());
assert(r.second == next(m.begin(), 3));
r = m.equal_range(C2Int(6));
assert(r.first == next(m.begin(), 3));
assert(r.second == next(m.begin(), 3));
r = m.equal_range(C2Int(7));
assert(r.first == next(m.begin(), 3));
assert(r.second == next(m.begin(), 6));
r = m.equal_range(C2Int(8));
assert(r.first == next(m.begin(), 6));
assert(r.second == next(m.begin(), 6));
r = m.equal_range(C2Int(9));
assert(r.first == next(m.begin(), 6));
assert(r.second == next(m.begin(), 9));
r = m.equal_range(C2Int(10));
assert(r.first == m.end());
assert(r.second == m.end());
}
{

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// XFAIL: c++03, c++11
// <map>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
int main()
{
typedef std::multimap<int, double, transparent_less> M;
M().equal_range(C2Int{5});
}

View File

@ -0,0 +1,37 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
typedef std::multimap<int, double, transparent_less_no_type> M;
M().equal_range(C2Int{5});
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_private> M;
M().equal_range(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;
M().equal_range(C2Int{5});
}
}
#endif

View File

@ -19,6 +19,7 @@
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
int main()
{
@ -174,6 +175,19 @@ int main()
assert(r == next(m.begin(), 6));
r = m.find(10);
assert(r == m.end());
r = m.find(C2Int(5));
assert(r == m.begin());
r = m.find(C2Int(6));
assert(r == m.end());
r = m.find(C2Int(7));
assert(r == next(m.begin(), 3));
r = m.find(C2Int(8));
assert(r == m.end());
r = m.find(C2Int(9));
assert(r == next(m.begin(), 6));
r = m.find(C2Int(10));
assert(r == m.end());
}
{

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// XFAIL: c++03, c++11
// <map>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
int main()
{
typedef std::multimap<int, double, transparent_less> M;
M().find(C2Int{5});
}

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_no_type> M;
M().find(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class map
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_private> M;
M().find(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;
M().find(C2Int{5});
}
}
#endif

View File

@ -19,6 +19,7 @@
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
int main()
{
@ -183,6 +184,21 @@ int main()
assert(r == next(m.begin(), 6));
r = m.lower_bound(10);
assert(r == m.end());
r = m.lower_bound(C2Int(4));
assert(r == m.begin());
r = m.lower_bound(C2Int(5));
assert(r == m.begin());
r = m.lower_bound(C2Int(6));
assert(r == next(m.begin(), 3));
r = m.lower_bound(C2Int(7));
assert(r == next(m.begin(), 3));
r = m.lower_bound(C2Int(8));
assert(r == next(m.begin(), 6));
r = m.lower_bound(C2Int(9));
assert(r == next(m.begin(), 6));
r = m.lower_bound(C2Int(10));
assert(r == m.end());
}
{

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// XFAIL: c++03, c++11
// <map>
// class multimap
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
int main()
{
typedef std::multimap<int, double, transparent_less> M;
M().lower_bound(C2Int{5});
}

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_no_type> M;
M().lower_bound(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_private> M;
M().lower_bound(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;
M().lower_bound(C2Int{5});
}
}
#endif

View File

@ -19,6 +19,7 @@
#include "min_allocator.h"
#include "private_constructor.hpp"
#include "is_transparent.h"
int main()
{
@ -183,6 +184,20 @@ int main()
assert(r == next(m.begin(), 9));
r = m.upper_bound(10);
assert(r == m.end());
r = m.upper_bound(C2Int(4));
assert(r == m.begin());
r = m.upper_bound(C2Int(5));
assert(r == next(m.begin(), 3));
r = m.upper_bound(C2Int(6));
assert(r == next(m.begin(), 3));
r = m.upper_bound(C2Int(7));
assert(r == next(m.begin(), 6));
r = m.upper_bound(C2Int(8));
assert(r == next(m.begin(), 6));
r = m.upper_bound(C2Int(9));
assert(r == next(m.begin(), 9));
r = m.upper_bound(C2Int(10));
}
{

View File

@ -0,0 +1,34 @@
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
//
// XFAIL: c++03, c++11
// <map>
// class multimap
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
int main()
{
typedef std::multimap<int, double, transparent_less> M;
M().upper_bound(C2Int{5});
}

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_no_type> M;
M().upper_bound(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_private> M;
M().upper_bound(C2Int{5});
}
}
#endif

View File

@ -0,0 +1,39 @@
//===----------------------------------------------------------------------===//
//
// 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>
// class multimap
// iterator upper_bound(const key_type& k);
// const_iterator upper_bound(const key_type& k) const;
//
// The member function templates find, count, lower_bound, upper_bound, and
// equal_range shall not participate in overload resolution unless the
// qualified-id Compare::is_transparent is valid and denotes a type
#include <map>
#include <cassert>
#include "is_transparent.h"
#if _LIBCPP_STD_VER <= 11
#error "This test requires is C++14 (or later)"
#else
int main()
{
{
typedef std::multimap<int, double, transparent_less_not_a_type> M;
M().upper_bound(C2Int{5});
}
}
#endif