Add static_assert to set/multiset/map/multimap/forward_list/deque that the allocator's value_type match the container's value_type. vector/unordered/list/string already do this. Add tests for all the containers to verify this.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@254119 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <map>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::map<int, int, std::less<int>, std::allocator<long> > m;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <map>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::multimap<int, int, std::less<int>, std::allocator<long> > m;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <set>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <set>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::multiset<int, std::less<int>, std::allocator<long> > ms;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <set>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <set>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::set<int, std::less<int>, std::allocator<long> > s;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <deque>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <deque>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::deque<int, std::allocator<long> > d;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <forward_list>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <forward_list>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::forward_list<int, std::allocator<long> > fl;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <list>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <list>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::list<int, std::allocator<long> > l;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <vector>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <vector>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::vector<int, std::allocator<long> > v;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <unordered_map>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::unordered_map<int, int, std::hash<int>, std::less<int>, std::allocator<long> > m;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <unordered_map>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::unordered_multimap<int, int, std::hash<int>, std::less<int>, std::allocator<long> > m;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <unordered_set>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::unordered_multiset<int, std::hash<int>, std::less<int>, std::allocator<long> > v;
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// <unordered_set>
|
||||
// The container's value type must be the same as the allocator's value type
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::unordered_set<int, std::hash<int>, std::less<int>, std::allocator<long> > v;
|
||||
}
|
Reference in New Issue
Block a user