Revert r260514 because it has a bogus commit message.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@260556 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -19,11 +19,8 @@
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
#include "MoveOnly.h"
|
||||
#include "min_allocator.h"
|
||||
#include "count_new.hpp"
|
||||
#include "container_test_types.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -47,7 +44,7 @@ int main()
|
||||
assert(c.size() == 5);
|
||||
assert(c.at(11) == "eleven");
|
||||
}
|
||||
#if TEST_STD_VER >= 11
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
typedef std::unordered_map<MoveOnly, std::string> C;
|
||||
typedef std::pair<int, std::string> P;
|
||||
@@ -68,6 +65,8 @@ int main()
|
||||
assert(c.size() == 5);
|
||||
assert(c.at(11) == "eleven");
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#if __cplusplus >= 201103L
|
||||
{
|
||||
typedef std::unordered_map<int, std::string, std::hash<int>, std::equal_to<int>,
|
||||
min_allocator<std::pair<const int, std::string>>> C;
|
||||
@@ -89,7 +88,7 @@ int main()
|
||||
assert(c.size() == 5);
|
||||
assert(c.at(11) == "eleven");
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
typedef std::unordered_map<MoveOnly, std::string, std::hash<MoveOnly>, std::equal_to<MoveOnly>,
|
||||
min_allocator<std::pair<const MoveOnly, std::string>>> C;
|
||||
@@ -111,50 +110,6 @@ int main()
|
||||
assert(c.size() == 5);
|
||||
assert(c.at(11) == "eleven");
|
||||
}
|
||||
{
|
||||
using Container = TCT::unordered_map<>;
|
||||
using Key = Container::key_type;
|
||||
using MappedType = Container::mapped_type;
|
||||
using ValueTp = Container::value_type;
|
||||
ConstructController* cc = getConstructController();
|
||||
cc->reset();
|
||||
{
|
||||
Container c;
|
||||
const Key k(1);
|
||||
cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
|
||||
MappedType& mref = c[k];
|
||||
assert(!cc->unchecked());
|
||||
{
|
||||
DisableAllocationGuard g;
|
||||
MappedType& mref2 = c[k];
|
||||
assert(&mref == &mref2);
|
||||
}
|
||||
}
|
||||
{
|
||||
Container c;
|
||||
Key k(1);
|
||||
cc->expect<std::piecewise_construct_t const&, std::tuple<Key const&>&&, std::tuple<>&&>();
|
||||
MappedType& mref = c[k];
|
||||
assert(!cc->unchecked());
|
||||
{
|
||||
DisableAllocationGuard g;
|
||||
MappedType& mref2 = c[k];
|
||||
assert(&mref == &mref2);
|
||||
}
|
||||
}
|
||||
{
|
||||
Container c;
|
||||
Key k(1);
|
||||
cc->expect<std::piecewise_construct_t const&, std::tuple<Key &&>&&, std::tuple<>&&>();
|
||||
MappedType& mref = c[std::move(k)];
|
||||
assert(!cc->unchecked());
|
||||
{
|
||||
Key k2(1);
|
||||
DisableAllocationGuard g;
|
||||
MappedType& mref2 = c[std::move(k2)];
|
||||
assert(&mref == &mref2);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: c++98, c++03
|
||||
|
||||
// <unordered_map>
|
||||
|
||||
// template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>,
|
||||
@@ -20,6 +18,9 @@
|
||||
// http://llvm.org/bugs/show_bug.cgi?id=16542
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#include <tuple>
|
||||
|
||||
using namespace std;
|
||||
@@ -29,8 +30,12 @@ struct my_hash
|
||||
size_t operator()(const tuple<int,int>&) const {return 0;}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
unordered_map<tuple<int,int>, size_t, my_hash> m;
|
||||
m[make_tuple(2,3)]=7;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -393,11 +393,6 @@ struct CopyInsertable {
|
||||
}
|
||||
}
|
||||
|
||||
CopyInsertable() : data(0), copied_once(false), constructed_under_allocator(true)
|
||||
{
|
||||
assert(getConstructController()->isInAllocatorConstruct());
|
||||
}
|
||||
|
||||
CopyInsertable(CopyInsertable const& other) : data(other.data),
|
||||
copied_once(true),
|
||||
constructed_under_allocator(true) {
|
||||
|
||||
Reference in New Issue
Block a user