diff options
| author | Howard Hinnant <hhinnant@apple.com> | 2013-09-21 21:13:54 +0000 |
|---|---|---|
| committer | Howard Hinnant <hhinnant@apple.com> | 2013-09-21 21:13:54 +0000 |
| commit | 7a828034c6cb65b846b8f7b18d730dd109f65b9e (patch) | |
| tree | c9988b01ec58f3fb553d01a59d4a48fafcdabe46 /libcxx/test/containers/sequences/vector | |
| parent | 1da6b4d5c8167fde7a74c0cf9245de088a1f059d (diff) | |
| download | bcm5719-llvm-7a828034c6cb65b846b8f7b18d730dd109f65b9e.tar.gz bcm5719-llvm-7a828034c6cb65b846b8f7b18d730dd109f65b9e.zip | |
Peter Collingbourne: If a pointer is passed as the third argument of the (iterator,
iterator, allocator) constructor with the intention of it being
implicitly converted to the allocator type, it is possible for overload
resolution to favour the (iterator, iterator, enable_if) constructor.
Eliminate this possibility by moving the enable_if to one of the
existing arguments and removing the third argument.
llvm-svn: 191145
Diffstat (limited to 'libcxx/test/containers/sequences/vector')
| -rw-r--r-- | libcxx/test/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libcxx/test/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp b/libcxx/test/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp index e386297cf7a..afc8ea5d3d2 100644 --- a/libcxx/test/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp +++ b/libcxx/test/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp @@ -19,9 +19,9 @@ #include "../../../stack_allocator.h" #include "../../../min_allocator.h" -template <class C, class Iterator> +template <class C, class Iterator, class A> void -test(Iterator first, Iterator last, const typename C::allocator_type& a) +test(Iterator first, Iterator last, const A& a) { C c(first, last, a); assert(c.__invariants()); @@ -30,6 +30,17 @@ test(Iterator first, Iterator last, const typename C::allocator_type& a) assert(*i == *first); } +#if __cplusplus >= 201103L + +template <class T> +struct implicit_conv_allocator : min_allocator<T> +{ + implicit_conv_allocator(void* p) {} + implicit_conv_allocator(const implicit_conv_allocator&) = default; +}; + +#endif + int main() { { @@ -52,6 +63,7 @@ int main() test<std::vector<int, min_allocator<int>> >(bidirectional_iterator<const int*>(a), bidirectional_iterator<const int*>(an), alloc); test<std::vector<int, min_allocator<int>> >(random_access_iterator<const int*>(a), random_access_iterator<const int*>(an), alloc); test<std::vector<int, min_allocator<int>> >(a, an, alloc); + test<std::vector<int, implicit_conv_allocator<int>> >(a, an, nullptr); } #endif } |

