From 1fab01f92bdb23bfce98ee1281fe7be10ec04373 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 18 Jun 2019 14:40:15 +0000 Subject: [PATCH] [libc++] Revert the addition of map/multimap CTAD This was found to be broken on Clang trunk. This is a revert of the following commits (the subsequent commits added XFAILs to the tests that were missing from the original submission): r362986: Implement deduction guides for map/multimap. r363014: Add some XFAILs r363097: Add more XFAILs r363197: Add even more XFAILs llvm-svn: 363688 --- libcxx/include/iterator | 16 -- libcxx/include/map | 57 +------- .../associative/map/map.cons/deduct.fail.cpp | 107 -------------- .../associative/map/map.cons/deduct.pass.cpp | 137 ------------------ .../map/map.cons/deduct_const.pass.cpp | 107 -------------- .../multimap/multimap.cons/deduct.fail.cpp | 107 -------------- .../multimap/multimap.cons/deduct.pass.cpp | 137 ------------------ .../multimap.cons/deduct_const.pass.cpp | 107 -------------- .../meta/meta.rel/is_base_of_union.pass.cpp | 3 +- 9 files changed, 3 insertions(+), 775 deletions(-) delete mode 100644 libcxx/test/std/containers/associative/map/map.cons/deduct.fail.cpp delete mode 100644 libcxx/test/std/containers/associative/map/map.cons/deduct.pass.cpp delete mode 100644 libcxx/test/std/containers/associative/map/map.cons/deduct_const.pass.cpp delete mode 100644 libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.fail.cpp delete mode 100644 libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp delete mode 100644 libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp diff --git a/libcxx/include/iterator b/libcxx/include/iterator index 30801ea83dbd..e73b4b713ed0 100644 --- a/libcxx/include/iterator +++ b/libcxx/include/iterator @@ -538,22 +538,6 @@ struct __is_exactly_input_iterator __has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value && !__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {}; -#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES -template -using __iter_value_type = typename iterator_traits<_InputIterator>::value_type; - -template -using __iter_key_type = remove_const_t::value_type::first_type>; - -template -using __iter_mapped_type = typename iterator_traits<_InputIterator>::value_type::second_type; - -template -using __iter_to_alloc_type = pair< - add_const_t::value_type::first_type>, - typename iterator_traits<_InputIterator>::value_type::second_type>; -#endif - template struct _LIBCPP_TEMPLATE_VIS iterator diff --git a/libcxx/include/map b/libcxx/include/map index 6b0bcb85555c..a8bf448dd57f 100644 --- a/libcxx/include/map +++ b/libcxx/include/map @@ -903,7 +903,7 @@ public: typedef _Tp mapped_type; typedef pair value_type; typedef _Compare key_compare; - typedef typename __identity<_Allocator>::type allocator_type; + typedef _Allocator allocator_type; typedef value_type& reference; typedef const value_type& const_reference; @@ -1465,32 +1465,6 @@ private: #endif }; -#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES -template>, - class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>, - class = typename enable_if::value, void>::type, - class = typename enable_if<__is_allocator<_Allocator>::value, void>::type> -map(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) - -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>; - -template::type>, - class _Allocator = allocator>, - class = typename enable_if::value, void>::type, - class = typename enable_if<__is_allocator<_Allocator>::value, void>::type> -map(initializer_list>, _Compare = _Compare(), _Allocator = _Allocator()) - -> map::type, _Tp, _Compare, _Allocator>; - -template::value, void>::type> -map(_InputIterator, _InputIterator, _Allocator) - -> map<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, - less<__iter_key_type<_InputIterator>>, _Allocator>; - -template::value, void>::type> -map(initializer_list>, _Allocator) - -> map::type, _Tp, less::type>, _Allocator>; -#endif #ifndef _LIBCPP_CXX03_LANG template @@ -1664,7 +1638,7 @@ public: typedef _Tp mapped_type; typedef pair value_type; typedef _Compare key_compare; - typedef typename __identity<_Allocator>::type allocator_type; + typedef _Allocator allocator_type; typedef value_type& reference; typedef const value_type& const_reference; @@ -2116,33 +2090,6 @@ private: typedef unique_ptr<__node, _Dp> __node_holder; }; -#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES -template>, - class _Allocator = allocator<__iter_to_alloc_type<_InputIterator>>, - class = typename enable_if::value, void>::type, - class = typename enable_if<__is_allocator<_Allocator>::value, void>::type> -multimap(_InputIterator, _InputIterator, _Compare = _Compare(), _Allocator = _Allocator()) - -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, _Compare, _Allocator>; - -template::type>, - class _Allocator = allocator>, - class = typename enable_if::value, void>::type, - class = typename enable_if<__is_allocator<_Allocator>::value, void>::type> -multimap(initializer_list>, _Compare = _Compare(), _Allocator = _Allocator()) - -> multimap::type, _Tp, _Compare, _Allocator>; - -template::value, void>::type> -multimap(_InputIterator, _InputIterator, _Allocator) - -> multimap<__iter_key_type<_InputIterator>, __iter_mapped_type<_InputIterator>, - less<__iter_key_type<_InputIterator>>, _Allocator>; - -template::value, void>::type> -multimap(initializer_list>, _Allocator) - -> multimap::type, _Tp, less::type>, _Allocator>; -#endif - #ifndef _LIBCPP_CXX03_LANG template multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a) diff --git a/libcxx/test/std/containers/associative/map/map.cons/deduct.fail.cpp b/libcxx/test/std/containers/associative/map/map.cons/deduct.fail.cpp deleted file mode 100644 index 2e719da6442b..000000000000 --- a/libcxx/test/std/containers/associative/map/map.cons/deduct.fail.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: libcpp-no-deduction-guides -// XFAIL: clang-6, apple-clang-9.0, apple-clang-9.1, apple-clang-10.0 -// clang-6 gives different error messages. - -// template>, -// class Allocator = allocator>> -// map(InputIterator, InputIterator, -// Compare = Compare(), Allocator = Allocator()) -// -> map, Compare, Allocator>; -// template, class Allocator = allocator> -// map(initializer_list, Compare = Compare(), Allocator = Allocator()) -// -> map; -// template -// map(InputIterator, InputIterator, Allocator) -// -> map, less>, Allocator>; -// template -// map(initializer_list, Allocator) -// -> map, Allocator>; - -#include // INT_MAX -#include -#include -#include - -struct NotAnAllocator { - friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; } -}; - -using P = std::pair; -using PC = std::pair; - -int main(int, char**) -{ - { - // cannot deduce Key and T from nothing - std::map m; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - { - // cannot deduce Key and T from just (Compare) - std::map m(std::less{}); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - { - // cannot deduce Key and T from just (Compare, Allocator) - std::map m(std::less{}, std::allocator{}); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - { - // cannot deduce Key and T from just (Allocator) - std::map m(std::allocator{}); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - { - // refuse to rebind the allocator if Allocator::value_type is not exactly what we expect - const P arr[] = { {1,1L}, {2,2L}, {3,3L} }; - std::map m(arr, arr + 3, std::allocator

()); - // expected-error-re@map:* {{static_assert failed{{( due to requirement '.*')?}} "Allocator::value_type must be same type as value_type"}} - } - { - // cannot convert from some arbitrary unrelated type - NotAnAllocator a; - std::map m(a); // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - { - // cannot deduce that the inner braced things should be std::pair and not something else - std::map m{ {1,1L}, {2,2L}, {3,3L} }; - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - { - // cannot deduce that the inner braced things should be std::pair and not something else - std::map m({ {1,1L}, {2,2L}, {3,3L} }, std::less()); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - { - // cannot deduce that the inner braced things should be std::pair and not something else - std::map m({ {1,1L}, {2,2L}, {3,3L} }, std::less(), std::allocator()); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - { - // cannot deduce that the inner braced things should be std::pair and not something else - std::map m({ {1,1L}, {2,2L}, {3,3L} }, std::allocator()); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - { - // since we have parens, not braces, this deliberately does not find the initializer_list constructor - std::map m(P{1,1L}); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - { - // since we have parens, not braces, this deliberately does not find the initializer_list constructor - std::map m(PC{1,1L}); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'map'}} - } - - return 0; -} diff --git a/libcxx/test/std/containers/associative/map/map.cons/deduct.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/deduct.pass.cpp deleted file mode 100644 index 9075d27106d4..000000000000 --- a/libcxx/test/std/containers/associative/map/map.cons/deduct.pass.cpp +++ /dev/null @@ -1,137 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: libcpp-no-deduction-guides - -// template>, -// class Allocator = allocator>> -// map(InputIterator, InputIterator, -// Compare = Compare(), Allocator = Allocator()) -// -> map, Compare, Allocator>; -// template, class Allocator = allocator> -// map(initializer_list, Compare = Compare(), Allocator = Allocator()) -// -> map; -// template -// map(InputIterator, InputIterator, Allocator) -// -> map, less>, Allocator>; -// template -// map(initializer_list, Allocator) -// -> map, Allocator>; - -#include // std::equal -#include -#include // INT_MAX -#include -#include -#include - -#include "test_allocator.h" - -using P = std::pair; -using PC = std::pair; - -int main(int, char**) -{ - { - const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::map m(std::begin(arr), std::end(arr)); - - ASSERT_SAME_TYPE(decltype(m), std::map); - const PC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::map m(std::begin(arr), std::end(arr), std::greater()); - - ASSERT_SAME_TYPE(decltype(m), std::map>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::map m(std::begin(arr), std::end(arr), std::greater(), test_allocator(0, 42)); - - ASSERT_SAME_TYPE(decltype(m), std::map, test_allocator>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 42); - } - - { - std::map source; - std::map m(source); - ASSERT_SAME_TYPE(decltype(m), decltype(source)); - assert(m.size() == 0); - } - - { - std::map source; - std::map m{source}; // braces instead of parens - ASSERT_SAME_TYPE(decltype(m), decltype(source)); - assert(m.size() == 0); - } - - { - std::map source; - std::map m(source, std::map::allocator_type()); - ASSERT_SAME_TYPE(decltype(m), decltype(source)); - assert(m.size() == 0); - } - - { - std::map m{ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }; - - ASSERT_SAME_TYPE(decltype(m), std::map); - const PC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - std::map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, std::greater()); - - ASSERT_SAME_TYPE(decltype(m), std::map>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - std::map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, std::greater(), test_allocator(0, 43)); - - ASSERT_SAME_TYPE(decltype(m), std::map, test_allocator>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 43); - } - - { - const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::map m(std::begin(arr), std::end(arr), test_allocator(0, 44)); - - ASSERT_SAME_TYPE(decltype(m), std::map, test_allocator>); - const PC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 44); - } - - { - std::map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, test_allocator(0, 45)); - - ASSERT_SAME_TYPE(decltype(m), std::map, test_allocator>); - const PC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 45); - } - - return 0; -} diff --git a/libcxx/test/std/containers/associative/map/map.cons/deduct_const.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/deduct_const.pass.cpp deleted file mode 100644 index 777853634036..000000000000 --- a/libcxx/test/std/containers/associative/map/map.cons/deduct_const.pass.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: libcpp-no-deduction-guides - -// template>, -// class Allocator = allocator>> -// map(InputIterator, InputIterator, -// Compare = Compare(), Allocator = Allocator()) -// -> map, Compare, Allocator>; -// template, class Allocator = allocator> -// map(initializer_list, Compare = Compare(), Allocator = Allocator()) -// -> map; -// template -// map(InputIterator, InputIterator, Allocator) -// -> map, less>, Allocator>; -// template -// map(initializer_list, Allocator) -// -> map, Allocator>; - -#include // std::equal -#include -#include // INT_MAX -#include -#include -#include - -#include "test_allocator.h" - -using P = std::pair; -using PC = std::pair; -using PCC = std::pair; - -int main(int, char**) -{ - { - const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::map m(std::begin(arr), std::end(arr)); - - ASSERT_SAME_TYPE(decltype(m), std::map); - const PCC expected_m[] = { {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::map m(std::begin(arr), std::end(arr), std::greater()); - - ASSERT_SAME_TYPE(decltype(m), std::map>); - const PCC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1, 1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::map m(std::begin(arr), std::end(arr), std::greater(), test_allocator(0, 42)); - - ASSERT_SAME_TYPE(decltype(m), std::map, test_allocator>); - const PCC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1, 1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 42); - } - - { - std::map m{ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }; - - ASSERT_SAME_TYPE(decltype(m), std::map); - const PC expected_m[] = { {1, 1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - std::map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, std::greater()); - - ASSERT_SAME_TYPE(decltype(m), std::map>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1, 1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - std::map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, std::greater(), test_allocator(0, 43)); - - ASSERT_SAME_TYPE(decltype(m), std::map, test_allocator>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1, 1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 43); - } - - { - std::map m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, test_allocator(0, 45)); - - ASSERT_SAME_TYPE(decltype(m), std::map, test_allocator>); - const PC expected_m[] = { {1, 1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 45); - } - - return 0; -} diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.fail.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.fail.cpp deleted file mode 100644 index 70fa2522cc1e..000000000000 --- a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.fail.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: libcpp-no-deduction-guides -// XFAIL: clang-6, apple-clang-9.0, apple-clang-9.1, apple-clang-10.0 -// clang-6 gives different error messages. - -// template>, -// class Allocator = allocator>> -// multimap(InputIterator, InputIterator, -// Compare = Compare(), Allocator = Allocator()) -// -> multimap, Compare, Allocator>; -// template, class Allocator = allocator> -// multimap(initializer_list, Compare = Compare(), Allocator = Allocator()) -// -> multimap; -// template -// multimap(InputIterator, InputIterator, Allocator) -// -> multimap, less>, Allocator>; -// template -// multimap(initializer_list, Allocator) -// -> multimap, Allocator>; - -#include // INT_MAX -#include -#include -#include - -struct NotAnAllocator { - friend bool operator<(NotAnAllocator, NotAnAllocator) { return false; } -}; - -using P = std::pair; -using PC = std::pair; - -int main(int, char**) -{ - { - // cannot deduce Key and T from nothing - std::multimap m; // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - { - // cannot deduce Key and T from just (Compare) - std::multimap m(std::less{}); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - { - // cannot deduce Key and T from just (Compare, Allocator) - std::multimap m(std::less{}, std::allocator{}); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - { - // cannot deduce Key and T from just (Allocator) - std::multimap m(std::allocator{}); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - { - // refuse to rebind the allocator if Allocator::value_type is not exactly what we expect - const P arr[] = { {1,1L}, {2,2L}, {3,3L} }; - std::multimap m(arr, arr + 3, std::allocator

()); - // expected-error-re@map:* {{static_assert failed{{( due to requirement '.*')?}} "Allocator::value_type must be same type as value_type"}} - } - { - // cannot convert from some arbitrary unrelated type - NotAnAllocator a; - std::multimap m(a); // expected-error{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - { - // cannot deduce that the inner braced things should be std::pair and not something else - std::multimap m{ {1,1L}, {2,2L}, {3,3L} }; - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - { - // cannot deduce that the inner braced things should be std::pair and not something else - std::multimap m({ {1,1L}, {2,2L}, {3,3L} }, std::less()); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - { - // cannot deduce that the inner braced things should be std::pair and not something else - std::multimap m({ {1,1L}, {2,2L}, {3,3L} }, std::less(), std::allocator()); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - { - // cannot deduce that the inner braced things should be std::pair and not something else - std::multimap m({ {1,1L}, {2,2L}, {3,3L} }, std::allocator()); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - { - // since we have parens, not braces, this deliberately does not find the initializer_list constructor - std::multimap m(P{1,1L}); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - { - // since we have parens, not braces, this deliberately does not find the initializer_list constructor - std::multimap m(PC{1,1L}); - // expected-error@-1{{no viable constructor or deduction guide for deduction of template arguments of 'multimap'}} - } - - return 0; -} diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp deleted file mode 100644 index 0a28d7835eaa..000000000000 --- a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct.pass.cpp +++ /dev/null @@ -1,137 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: libcpp-no-deduction-guides - -// template>, -// class Allocator = allocator>> -// multimap(InputIterator, InputIterator, -// Compare = Compare(), Allocator = Allocator()) -// -> multimap, Compare, Allocator>; -// template, class Allocator = allocator> -// multimap(initializer_list, Compare = Compare(), Allocator = Allocator()) -// -> multimap; -// template -// multimap(InputIterator, InputIterator, Allocator) -// -> multimap, less>, Allocator>; -// template -// multimap(initializer_list, Allocator) -// -> multimap, Allocator>; - -#include // std::equal -#include -#include // INT_MAX -#include -#include -#include - -#include "test_allocator.h" - -using P = std::pair; -using PC = std::pair; - -int main(int, char**) -{ - { - const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::multimap m(std::begin(arr), std::end(arr)); - - ASSERT_SAME_TYPE(decltype(m), std::multimap); - const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::multimap m(std::begin(arr), std::end(arr), std::greater()); - - ASSERT_SAME_TYPE(decltype(m), std::multimap>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::multimap m(std::begin(arr), std::end(arr), std::greater(), test_allocator(0, 42)); - - ASSERT_SAME_TYPE(decltype(m), std::multimap, test_allocator>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 42); - } - - { - std::multimap source; - std::multimap m(source); - ASSERT_SAME_TYPE(decltype(m), decltype(source)); - assert(m.size() == 0); - } - - { - std::multimap source; - std::multimap m{source}; // braces instead of parens - ASSERT_SAME_TYPE(decltype(m), decltype(source)); - assert(m.size() == 0); - } - - { - std::multimap source; - std::multimap m(source, std::map::allocator_type()); - ASSERT_SAME_TYPE(decltype(m), decltype(source)); - assert(m.size() == 0); - } - - { - std::multimap m{ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }; - - ASSERT_SAME_TYPE(decltype(m), std::multimap); - const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - std::multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, std::greater()); - - ASSERT_SAME_TYPE(decltype(m), std::multimap>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - std::multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, std::greater(), test_allocator(0, 43)); - - ASSERT_SAME_TYPE(decltype(m), std::multimap, test_allocator>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 43); - } - - { - const P arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::multimap m(std::begin(arr), std::end(arr), test_allocator(0, 44)); - - ASSERT_SAME_TYPE(decltype(m), std::multimap, test_allocator>); - const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 44); - } - - { - std::multimap m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, test_allocator(0, 45)); - - ASSERT_SAME_TYPE(decltype(m), std::multimap, test_allocator>); - const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 45); - } - - return 0; -} diff --git a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp b/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp deleted file mode 100644 index 1c1eb2fd74f2..000000000000 --- a/libcxx/test/std/containers/associative/multimap/multimap.cons/deduct_const.pass.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -// -// UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: libcpp-no-deduction-guides - -// template>, -// class Allocator = allocator>> -// multimap(InputIterator, InputIterator, -// Compare = Compare(), Allocator = Allocator()) -// -> multimap, Compare, Allocator>; -// template, class Allocator = allocator> -// multimap(initializer_list, Compare = Compare(), Allocator = Allocator()) -// -> multimap; -// template -// multimap(InputIterator, InputIterator, Allocator) -// -> multimap, less>, Allocator>; -// template -// multimap(initializer_list, Allocator) -// -> multimap, Allocator>; - -#include // std::equal -#include -#include // INT_MAX -#include -#include -#include - -#include "test_allocator.h" - -using P = std::pair; -using PC = std::pair; -using PCC = std::pair; - -int main(int, char**) -{ - { - const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::multimap m(std::begin(arr), std::end(arr)); - - ASSERT_SAME_TYPE(decltype(m), std::multimap); - const PCC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::multimap m(std::begin(arr), std::end(arr), std::greater()); - - ASSERT_SAME_TYPE(decltype(m), std::multimap>); - const PCC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - const PCC arr[] = { {1,1L}, {2,2L}, {1,1L}, {INT_MAX,1L}, {3,1L} }; - std::multimap m(std::begin(arr), std::end(arr), std::greater(), test_allocator(0, 42)); - - ASSERT_SAME_TYPE(decltype(m), std::multimap, test_allocator>); - const PCC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 42); - } - - { - std::multimap m{ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }; - - ASSERT_SAME_TYPE(decltype(m), std::multimap); - const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - std::multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, std::greater()); - - ASSERT_SAME_TYPE(decltype(m), std::multimap>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - } - - { - std::multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, std::greater(), test_allocator(0, 43)); - - ASSERT_SAME_TYPE(decltype(m), std::multimap, test_allocator>); - const PC expected_m[] = { {INT_MAX,1L}, {3,1L}, {2,2L}, {1,1L}, {1,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 43); - } - - { - std::multimap m({ PC{1,1L}, PC{2,2L}, PC{1,1L}, PC{INT_MAX,1L}, PC{3,1L} }, test_allocator(0, 45)); - - ASSERT_SAME_TYPE(decltype(m), std::multimap, test_allocator>); - const PC expected_m[] = { {1,1L}, {1,1L}, {2,2L}, {3,1L}, {INT_MAX,1L} }; - assert(std::equal(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); - assert(m.get_allocator().get_id() == 45); - } - - return 0; -} diff --git a/libcxx/test/std/utilities/meta/meta.rel/is_base_of_union.pass.cpp b/libcxx/test/std/utilities/meta/meta.rel/is_base_of_union.pass.cpp index 59f231f3c4de..67cffbd3613a 100644 --- a/libcxx/test/std/utilities/meta/meta.rel/is_base_of_union.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.rel/is_base_of_union.pass.cpp @@ -17,8 +17,7 @@ // Clang before v9 and apple-clang up to and including v10 do not // report that unions are never base classes - nor can they have bases. // See https://reviews.llvm.org/D61858 -// XFAIL: apple-clang-6.0, apple-clang-7.0, apple-clang-8.0 -// XFAIL: apple-clang-9.0, apple-clang-9.1, apple-clang-10.0 +// XFAIL: apple-clang-6.0, apple-clang-7.0, apple-clang-8.0, apple-clang-9.0, apple-clang-10.0 // XFAIL: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9 // XFAIL: clang-4.0, clang-5.0, clang-6.0, clang-7.0, clang-8.0