aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp1
-rw-r--r--test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp1
-rw-r--r--test/libcxx/include_as_c.sh.cpp37
-rw-r--r--test/libcxx/utilities/utility/__is_inplace_index.pass.cpp34
-rw-r--r--test/libcxx/utilities/utility/__is_inplace_type.pass.cpp34
-rw-r--r--test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp25
-rw-r--r--test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp36
-rw-r--r--test/std/containers/associative/map/map.ops/count0.pass.cpp7
-rw-r--r--test/std/containers/associative/map/map.ops/equal_range0.pass.cpp7
-rw-r--r--test/std/containers/associative/map/map.ops/find0.pass.cpp7
-rw-r--r--test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp7
-rw-r--r--test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp7
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp7
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp7
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp7
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp7
-rw-r--r--test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp7
-rw-r--r--test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp35
-rw-r--r--test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp35
-rw-r--r--test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp (renamed from test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp)0
-rw-r--r--test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp (renamed from test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter_init_op.pass.cpp)0
-rw-r--r--test/std/numerics/numeric.ops/reduce/reduce.pass.cpp63
-rw-r--r--test/std/numerics/numeric.ops/reduce/reduce_init.pass.cpp67
-rw-r--r--test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp74
-rw-r--r--test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp (renamed from test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_iter_iter_iter_init_bop_uop.pass.cpp)6
-rw-r--r--test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp124
-rw-r--r--test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp95
-rw-r--r--test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp97
-rw-r--r--test/support/allocators.h2
-rw-r--r--test/support/is_transparent.h16
30 files changed, 838 insertions, 14 deletions
diff --git a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
index ef3ef7519d69..28a9281b49c2 100644
--- a/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
+++ b/test/libcxx/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
@@ -23,6 +23,7 @@
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
// is defined before including <algorithm>, then random_shuffle will be restored.
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
#define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
#include <algorithm>
diff --git a/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp b/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
index 9b846939313b..f06dbb927acb 100644
--- a/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
+++ b/test/libcxx/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
@@ -14,6 +14,7 @@
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
// is defined before including <functional>, then they will be restored.
+// MODULES_DEFINES: _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
#include <functional>
diff --git a/test/libcxx/include_as_c.sh.cpp b/test/libcxx/include_as_c.sh.cpp
new file mode 100644
index 000000000000..db50d835ec1f
--- /dev/null
+++ b/test/libcxx/include_as_c.sh.cpp
@@ -0,0 +1,37 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// Test that the C wrapper headers can be included when compiling them as C.
+
+// NOTE: It's not common or recommended to have libc++ in the header search
+// path when compiling C files, but it does happen often enough.
+
+// RUN: %cxx -c -xc %s -fsyntax-only %flags %compile_flags -std=c99
+
+#include <complex.h>
+#include <ctype.h>
+#include <errno.h>
+#include <float.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <locale.h>
+#include <math.h>
+#include <setjmp.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <tgmath.h>
+#include <wchar.h>
+#include <wctype.h>
+
+int main() {}
diff --git a/test/libcxx/utilities/utility/__is_inplace_index.pass.cpp b/test/libcxx/utilities/utility/__is_inplace_index.pass.cpp
new file mode 100644
index 000000000000..073cfac075f3
--- /dev/null
+++ b/test/libcxx/utilities/utility/__is_inplace_index.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template <class _Tp> using __is_inplace_index
+
+#include <utility>
+
+struct S {};
+
+int main() {
+ using I = std::in_place_index_t<0>;
+ static_assert( std::__is_inplace_index<I>::value, "");
+ static_assert( std::__is_inplace_index<const I>::value, "");
+ static_assert( std::__is_inplace_index<const volatile I>::value, "");
+ static_assert( std::__is_inplace_index<I&>::value, "");
+ static_assert( std::__is_inplace_index<const I&>::value, "");
+ static_assert( std::__is_inplace_index<const volatile I&>::value, "");
+ static_assert( std::__is_inplace_index<I&&>::value, "");
+ static_assert( std::__is_inplace_index<const I&&>::value, "");
+ static_assert( std::__is_inplace_index<const volatile I&&>::value, "");
+ static_assert(!std::__is_inplace_index<std::in_place_type_t<int>>::value, "");
+ static_assert(!std::__is_inplace_index<std::in_place_t>::value, "");
+ static_assert(!std::__is_inplace_index<void>::value, "");
+ static_assert(!std::__is_inplace_index<int>::value, "");
+ static_assert(!std::__is_inplace_index<S>::value, "");
+}
diff --git a/test/libcxx/utilities/utility/__is_inplace_type.pass.cpp b/test/libcxx/utilities/utility/__is_inplace_type.pass.cpp
new file mode 100644
index 000000000000..54e22a0939da
--- /dev/null
+++ b/test/libcxx/utilities/utility/__is_inplace_type.pass.cpp
@@ -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.
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template <class _Tp> using __is_inplace_type
+
+#include <utility>
+
+struct S {};
+
+int main() {
+ using T = std::in_place_type_t<int>;
+ static_assert( std::__is_inplace_type<T>::value, "");
+ static_assert( std::__is_inplace_type<const T>::value, "");
+ static_assert( std::__is_inplace_type<const volatile T>::value, "");
+ static_assert( std::__is_inplace_type<T&>::value, "");
+ static_assert( std::__is_inplace_type<const T&>::value, "");
+ static_assert( std::__is_inplace_type<const volatile T&>::value, "");
+ static_assert( std::__is_inplace_type<T&&>::value, "");
+ static_assert( std::__is_inplace_type<const T&&>::value, "");
+ static_assert( std::__is_inplace_type<const volatile T&&>::value, "");
+ static_assert(!std::__is_inplace_type<std::in_place_index_t<0>>::value, "");
+ static_assert(!std::__is_inplace_type<std::in_place_t>::value, "");
+ static_assert(!std::__is_inplace_type<void>::value, "");
+ static_assert(!std::__is_inplace_type<int>::value, "");
+ static_assert(!std::__is_inplace_type<S>::value, "");
+}
diff --git a/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp b/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
new file mode 100644
index 000000000000..2a92240a63d2
--- /dev/null
+++ b/test/libcxx/utilities/utility/pairs/pairs.pair/pair.tuple_element.fail.cpp
@@ -0,0 +1,25 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// tuple_element<I, pair<T1, T2> >::type
+
+#include <utility>
+
+int main()
+{
+ {
+ typedef std::pair<int, double> P;
+ std::tuple_element<2, P>::type foo; // expected-note {{requested here}}
+ // expected-error@utility:* {{static_assert failed "Index out of bounds in std::tuple_element<std::pair<T1, T2>>"}}
+ }
+}
diff --git a/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp b/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
new file mode 100644
index 000000000000..f39a445b98af
--- /dev/null
+++ b/test/libcxx/utilities/variant/variant.variant/variant.helper/variant_alternative.fail.cpp
@@ -0,0 +1,36 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <variant>
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+
+// template <size_t I, class T> struct variant_alternative; // undefined
+// template <size_t I, class T> struct variant_alternative<I, const T>;
+// template <size_t I, class T> struct variant_alternative<I, volatile T>;
+// template <size_t I, class T> struct variant_alternative<I, const volatile T>;
+// template <size_t I, class T>
+// using variant_alternative_t = typename variant_alternative<I, T>::type;
+//
+// template <size_t I, class... Types>
+// struct variant_alternative<I, variant<Types...>>;
+
+
+#include <variant>
+#include <cassert>
+
+
+int main()
+{
+ {
+ typedef std::variant<int, double> T;
+ std::variant_alternative<2, T>::type foo; // expected-note {{requested here}}
+ // expected-error@variant:* {{static_assert failed "Index out of bounds in std::variant_alternative<>"}}
+ }
+}
diff --git a/test/std/containers/associative/map/map.ops/count0.pass.cpp b/test/std/containers/associative/map/map.ops/count0.pass.cpp
index 0278343006a8..1fa8c4a70bd9 100644
--- a/test/std/containers/associative/map/map.ops/count0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/count0.pass.cpp
@@ -28,7 +28,12 @@
int main()
{
+ {
typedef std::map<int, double, transparent_less> M;
-
M().count(C2Int{5});
+ }
+ {
+ typedef std::map<int, double, transparent_less_not_referenceable> M;
+ M().count(C2Int{5});
+ }
}
diff --git a/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp b/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
index 3b98426868e4..c254fb6a7db7 100644
--- a/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/equal_range0.pass.cpp
@@ -28,7 +28,12 @@
int main()
{
+ {
typedef std::map<int, double, transparent_less> M;
-
M().equal_range(C2Int{5});
+ }
+ {
+ typedef std::map<int, double, transparent_less_not_referenceable> M;
+ M().equal_range(C2Int{5});
+ }
}
diff --git a/test/std/containers/associative/map/map.ops/find0.pass.cpp b/test/std/containers/associative/map/map.ops/find0.pass.cpp
index d7de579d8b44..76fe9242a476 100644
--- a/test/std/containers/associative/map/map.ops/find0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/find0.pass.cpp
@@ -28,7 +28,12 @@
int main()
{
+ {
typedef std::map<int, double, transparent_less> M;
-
M().find(C2Int{5});
+ }
+ {
+ typedef std::map<int, double, transparent_less_not_referenceable> M;
+ M().find(C2Int{5});
+ }
}
diff --git a/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp b/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
index ea121df73002..de7a545b6497 100644
--- a/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/lower_bound0.pass.cpp
@@ -28,7 +28,12 @@
int main()
{
+ {
typedef std::map<int, double, transparent_less> M;
-
M().lower_bound(C2Int{5});
+ }
+ {
+ typedef std::map<int, double, transparent_less_not_referenceable> M;
+ M().lower_bound(C2Int{5});
+ }
}
diff --git a/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp b/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
index 2e597b85cf0c..94508d284fd2 100644
--- a/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
+++ b/test/std/containers/associative/map/map.ops/upper_bound0.pass.cpp
@@ -28,7 +28,12 @@
int main()
{
+ {
typedef std::map<int, double, transparent_less> M;
-
M().upper_bound(C2Int{5});
+ }
+ {
+ typedef std::map<int, double, transparent_less_not_referenceable> M;
+ M().upper_bound(C2Int{5});
+ }
}
diff --git a/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
index b993f4f89087..289d405739ac 100644
--- a/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/count0.pass.cpp
@@ -28,7 +28,12 @@
int main()
{
+ {
typedef std::multimap<int, double, transparent_less> M;
-
M().count(C2Int{5});
+ }
+ {
+ typedef std::multimap<int, double, transparent_less_not_referenceable> M;
+ M().count(C2Int{5});
+ }
}
diff --git a/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
index a3a51e6ccbf9..8cdd3c03372f 100644
--- a/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/equal_range0.pass.cpp
@@ -28,7 +28,12 @@
int main()
{
+ {
typedef std::multimap<int, double, transparent_less> M;
-
M().equal_range(C2Int{5});
+ }
+ {
+ typedef std::multimap<int, double, transparent_less_not_referenceable> M;
+ M().equal_range(C2Int{5});
+ }
}
diff --git a/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
index 03a6e1883051..a06ec4d702d5 100644
--- a/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/find0.pass.cpp
@@ -28,7 +28,12 @@
int main()
{
+ {
typedef std::multimap<int, double, transparent_less> M;
-
M().find(C2Int{5});
+ }
+ {
+ typedef std::multimap<int, double, transparent_less_not_referenceable> M;
+ M().find(C2Int{5});
+ }
}
diff --git a/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
index 77927bb5abed..1000aa772b31 100644
--- a/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/lower_bound0.pass.cpp
@@ -28,7 +28,12 @@
int main()
{
+ {
typedef std::multimap<int, double, transparent_less> M;
-
M().lower_bound(C2Int{5});
+ }
+ {
+ typedef std::multimap<int, double, transparent_less_not_referenceable> M;
+ M().lower_bound(C2Int{5});
+ }
}
diff --git a/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp b/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
index 3f6852d085c3..1a572e9c5070 100644
--- a/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
+++ b/test/std/containers/associative/multimap/multimap.ops/upper_bound0.pass.cpp
@@ -28,7 +28,12 @@
int main()
{
+ {
typedef std::multimap<int, double, transparent_less> M;
-
M().upper_bound(C2Int{5});
+ }
+ {
+ typedef std::multimap<int, double, transparent_less_not_referenceable> M;
+ M().upper_bound(C2Int{5});
+ }
}
diff --git a/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp b/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp
new file mode 100644
index 000000000000..c9fe695f9cbd
--- /dev/null
+++ b/test/std/containers/sequences/array/array.tuple/tuple_element.fail.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// tuple_element<I, array<T, N> >::type
+
+// Prevent -Warray-bounds from issuing a diagnostic when testing with clang verify.
+#if defined(__clang__)
+#pragma clang diagnostic ignored "-Warray-bounds"
+#endif
+
+#include <array>
+#include <cassert>
+
+
+// std::array is explicitly allowed to be initialized with A a = { init-list };.
+// Disable the missing braces warning for this reason.
+#include "disable_missing_braces_warning.h"
+
+int main()
+{
+ {
+ typedef double T;
+ typedef std::array<T, 3> C;
+ std::tuple_element<3, C> foo; // expected-note {{requested here}}
+ // expected-error@array:* {{static_assert failed "Index out of bounds in std::tuple_element<> (std::array)"}}
+ }
+}
diff --git a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp
index 4a61047a830a..f996886c4ca7 100644
--- a/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp
+++ b/test/std/experimental/language.support/support.coroutines/coroutine.handle/coroutine.handle.prom/promise.pass.cpp
@@ -28,6 +28,39 @@
namespace coro = std::experimental;
+struct MyCoro {
+ struct promise_type {
+ void unhandled_exception() {}
+ void return_void() {}
+ coro::suspend_never initial_suspend() { return {}; }
+ coro::suspend_never final_suspend() { return {}; }
+ MyCoro get_return_object() {
+ do_runtime_test();
+ return {};
+ }
+ void do_runtime_test() {
+ // Test that a coroutine_handle<const T> can be created from a const
+ // promise_type and that it represents the same coroutine as
+ // coroutine_handle<T>
+ using CH = coro::coroutine_handle<promise_type>;
+ using CCH = coro::coroutine_handle<const promise_type>;
+ const auto &cthis = *this;
+ CH h = CH::from_promise(*this);
+ CCH h2 = CCH::from_promise(*this);
+ CCH h3 = CCH::from_promise(cthis);
+ assert(&h.promise() == this);
+ assert(&h2.promise() == this);
+ assert(&h3.promise() == this);
+ assert(h.address() == h2.address());
+ assert(h2.address() == h3.address());
+ }
+ };
+};
+
+MyCoro do_runtime_test() {
+ co_await coro::suspend_never{};
+}
+
template <class Promise>
void do_test(coro::coroutine_handle<Promise>&& H) {
@@ -46,4 +79,6 @@ void do_test(coro::coroutine_handle<Promise>&& H) {
int main()
{
do_test(coro::coroutine_handle<int>{});
+ do_test(coro::coroutine_handle<const int>{});
+ do_runtime_test();
}
diff --git a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
index 6fdd288e2d6a..6fdd288e2d6a 100644
--- a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp
+++ b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan.pass.cpp
diff --git a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter_init_op.pass.cpp b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp
index ba1673fe467f..ba1673fe467f 100644
--- a/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter_init_op.pass.cpp
+++ b/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_init_op.pass.cpp
diff --git a/test/std/numerics/numeric.ops/reduce/reduce.pass.cpp b/test/std/numerics/numeric.ops/reduce/reduce.pass.cpp
new file mode 100644
index 000000000000..aa055e70d4f8
--- /dev/null
+++ b/test/std/numerics/numeric.ops/reduce/reduce.pass.cpp
@@ -0,0 +1,63 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <numeric>
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template<class InputIterator>
+// typename iterator_traits<InputIterator>::value_type
+// reduce(InputIterator first, InputIterator last);
+
+#include <numeric>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter, class T>
+void
+test(Iter first, Iter last, T x)
+{
+ static_assert( std::is_same_v<typename std::iterator_traits<decltype(first)>::value_type,
+ decltype(std::reduce(first, last))> );
+ assert(std::reduce(first, last) == x);
+}
+
+template <class Iter>
+void
+test()
+{
+ int ia[] = {1, 2, 3, 4, 5, 6};
+ unsigned sa = sizeof(ia) / sizeof(ia[0]);
+ test(Iter(ia), Iter(ia), 0);
+ test(Iter(ia), Iter(ia+1), 1);
+ test(Iter(ia), Iter(ia+2), 3);
+ test(Iter(ia), Iter(ia+sa), 21);
+}
+
+template <typename T>
+void test_return_type()
+{
+ T *p = nullptr;
+ static_assert( std::is_same_v<T, decltype(std::reduce(p, p))> );
+}
+
+int main()
+{
+ test_return_type<char>();
+ test_return_type<int>();
+ test_return_type<unsigned long>();
+ test_return_type<float>();
+ test_return_type<double>();
+
+ test<input_iterator<const int*> >();
+ test<forward_iterator<const int*> >();
+ test<bidirectional_iterator<const int*> >();
+ test<random_access_iterator<const int*> >();
+ test<const int*>();
+}
diff --git a/test/std/numerics/numeric.ops/reduce/reduce_init.pass.cpp b/test/std/numerics/numeric.ops/reduce/reduce_init.pass.cpp
new file mode 100644
index 000000000000..480ead11c734
--- /dev/null
+++ b/test/std/numerics/numeric.ops/reduce/reduce_init.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <numeric>
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template<class InputIterator, class T>
+// T reduce(InputIterator first, InputIterator last, T init);
+
+#include <numeric>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter, class T>
+void
+test(Iter first, Iter last, T init, T x)
+{
+ static_assert( std::is_same_v<T, decltype(std::reduce(first, last, init))> );
+ assert(std::reduce(first, last, init) == x);
+}
+
+template <class Iter>
+void
+test()
+{
+ int ia[] = {1, 2, 3, 4, 5, 6};
+ unsigned sa = sizeof(ia) / sizeof(ia[0]);
+ test(Iter(ia), Iter(ia), 0, 0);
+ test(Iter(ia), Iter(ia), 1, 1);
+ test(Iter(ia), Iter(ia+1), 0, 1);
+ test(Iter(ia), Iter(ia+1), 2, 3);
+ test(Iter(ia), Iter(ia+2), 0, 3);
+ test(Iter(ia), Iter(ia+2), 3, 6);
+ test(Iter(ia), Iter(ia+sa), 0, 21);
+ test(Iter(ia), Iter(ia+sa), 4, 25);
+}
+
+template <typename T, typename Init>
+void test_return_type()
+{
+ T *p = nullptr;
+ static_assert( std::is_same_v<Init, decltype(std::reduce(p, p, Init{}))> );
+}
+
+int main()
+{
+ test_return_type<char, int>();
+ test_return_type<int, int>();
+ test_return_type<int, unsigned long>();
+ test_return_type<float, int>();
+ test_return_type<short, float>();
+ test_return_type<double, char>();
+ test_return_type<char, double>();
+
+ test<input_iterator<const int*> >();
+ test<forward_iterator<const int*> >();
+ test<bidirectional_iterator<const int*> >();
+ test<random_access_iterator<const int*> >();
+ test<const int*>();
+}
diff --git a/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp b/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp
new file mode 100644
index 000000000000..5238a1f2ed5b
--- /dev/null
+++ b/test/std/numerics/numeric.ops/reduce/reduce_init_op.pass.cpp
@@ -0,0 +1,74 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <numeric>
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template<class InputIterator, class T, class BinaryOperation>
+// T reduce(InputIterator first, InputIterator last, T init, BinaryOperation op);
+
+#include <numeric>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter, class T, class Op>
+void
+test(Iter first, Iter last, T init, Op op, T x)
+{
+ static_assert( std::is_same_v<T, decltype(std::reduce(first, last, init, op))>, "" );
+ assert(std::reduce(first, last, init, op) == x);
+}
+
+template <class Iter>
+void
+test()
+{
+ int ia[] = {1, 2, 3, 4, 5, 6};
+ unsigned sa = sizeof(ia) / sizeof(ia[0]);
+ test(Iter(ia), Iter(ia), 0, std::plus<>(), 0);
+ test(Iter(ia), Iter(ia), 1, std::multiplies<>(), 1);
+ test(Iter(ia), Iter(ia+1), 0, std::plus<>(), 1);
+ test(Iter(ia), Iter(ia+1), 2, std::multiplies<>(), 2);
+ test(Iter(ia), Iter(ia+2), 0, std::plus<>(), 3);
+ test(Iter(ia), Iter(ia+2), 3, std::multiplies<>(), 6);
+ test(Iter(ia), Iter(ia+sa), 0, std::plus<>(), 21);
+ test(Iter(ia), Iter(ia+sa), 4, std::multiplies<>(), 2880);
+}
+
+template <typename T, typename Init>
+void test_return_type()
+{
+ T *p = nullptr;
+ static_assert( std::is_same_v<Init, decltype(std::reduce(p, p, Init{}, std::plus<>()))>, "" );
+}
+
+int main()
+{
+ test_return_type<char, int>();
+ test_return_type<int, int>();
+ test_return_type<int, unsigned long>();
+ test_return_type<float, int>();
+ test_return_type<short, float>();
+ test_return_type<double, char>();
+ test_return_type<char, double>();
+
+ test<input_iterator<const int*> >();
+ test<forward_iterator<const int*> >();
+ test<bidirectional_iterator<const int*> >();
+ test<random_access_iterator<const int*> >();
+ test<const int*>();
+
+// Make sure the math is done using the correct type
+ {
+ auto v = {1, 2, 3, 4, 5, 6, 7, 8};
+ unsigned res = std::reduce(v.begin(), v.end(), 1U, std::multiplies<>());
+ assert(res == 40320); // 8! will not fit into a char
+ }
+}
diff --git a/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_iter_iter_iter_init_bop_uop.pass.cpp b/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
index 3bfb336a03f9..2370e9ea9137 100644
--- a/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_iter_iter_iter_init_bop_uop.pass.cpp
+++ b/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_init_bop_uop.pass.cpp
@@ -122,6 +122,12 @@ void basic_tests()
assert(v[i] == 40 + triangle(i));
}
+ {
+ std::vector<int> v, res;
+ std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 40, std::plus<>(), identity<>());
+ assert(res.empty());
+ }
+
// Make sure that the calculations are done using the init typedef
{
std::vector<unsigned char> v(10);
diff --git a/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp b/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp
new file mode 100644
index 000000000000..c283f3e29722
--- /dev/null
+++ b/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_init_bop_uop.pass.cpp
@@ -0,0 +1,124 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <numeric>
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template <class InputIterator1, class T,
+// class BinaryOperation, class UnaryOperation>
+// T transform_reduce(InputIterator1 first1, InputIterator1 last1,
+// T init, BinaryOperation binary_op, UnaryOperation unary_op);
+//
+
+#include <numeric>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class _Tp = void>
+struct identity : std::unary_function<_Tp, _Tp>
+{
+ constexpr const _Tp& operator()(const _Tp& __x) const { return __x;}
+};
+
+template <>
+struct identity<void>
+{
+ template <class _Tp>
+ constexpr auto operator()(_Tp&& __x) const
+ _NOEXCEPT_(noexcept(_VSTD::forward<_Tp>(__x)))
+ -> decltype (_VSTD::forward<_Tp>(__x))
+ { return _VSTD::forward<_Tp>(__x); }
+};
+
+
+template <class _Tp = void>
+struct twice
+{
+ constexpr const _Tp operator()(const _Tp& __x) const noexcept { return 2 * __x; }
+};
+
+template <>
+struct twice<void>
+{
+ template <class _Tp>
+ constexpr auto operator()(const _Tp& __x) const
+ _NOEXCEPT_(noexcept(2 * __x))
+ -> decltype (2 * __x)
+ { return 2 * __x; }
+};
+
+template <class Iter1, class T, class BOp, class UOp>
+void
+test(Iter1 first1, Iter1 last1, T init, BOp bOp, UOp uOp, T x)
+{
+ static_assert( std::is_same_v<T,
+ decltype(std::transform_reduce(first1, last1, init, bOp, uOp))> );
+ assert(std::transform_reduce(first1, last1, init, bOp, uOp) == x);
+}
+
+template <class Iter>
+void
+test()
+{
+ int ia[] = {1, 2, 3, 4, 5, 6};
+ unsigned sa = sizeof(ia) / sizeof(ia[0]);
+
+ test(Iter(ia), Iter(ia), 0, std::plus<>(), identity<>(), 0);
+ test(Iter(ia), Iter(ia), 1, std::multiplies<>(), identity<>(), 1);
+ test(Iter(ia), Iter(ia+1), 0, std::multiplies<>(), identity<>(), 0);
+ test(Iter(ia), Iter(ia+1), 2, std::plus<>(), identity<>(), 3);
+ test(Iter(ia), Iter(ia+2), 0, std::plus<>(), identity<>(), 3);
+ test(Iter(ia), Iter(ia+2), 3, std::multiplies<>(), identity<>(), 6);
+ test(Iter(ia), Iter(ia+sa), 4, std::multiplies<>(), identity<>(), 2880);
+ test(Iter(ia), Iter(ia+sa), 4, std::plus<>(), identity<>(), 25);
+
+ test(Iter(ia), Iter(ia), 0, std::plus<>(), twice<>(), 0);
+ test(Iter(ia), Iter(ia), 1, std::multiplies<>(), twice<>(), 1);
+ test(Iter(ia), Iter(ia+1), 0, std::multiplies<>(), twice<>(), 0);
+ test(Iter(ia), Iter(ia+1), 2, std::plus<>(), twice<>(), 4);
+ test(Iter(ia), Iter(ia+2), 0, std::plus<>(), twice<>(), 6);
+ test(Iter(ia), Iter(ia+2), 3, std::multiplies<>(), twice<>(), 24);
+ test(Iter(ia), Iter(ia+sa), 4, std::multiplies<>(), twice<>(), 184320); // 64 * 2880
+ test(Iter(ia), Iter(ia+sa), 4, std::plus<>(), twice<>(), 46);
+}
+
+template <typename T, typename Init>
+void test_return_type()
+{
+ T *p = nullptr;
+ static_assert( std::is_same_v<Init,
+ decltype(std::transform_reduce(p, p, Init{}, std::plus<>(), identity<>()))> );
+}
+
+int main()
+{
+ test_return_type<char, int>();
+ test_return_type<int, int>();
+ test_return_type<int, unsigned long>();
+ test_return_type<float, int>();
+ test_return_type<short, float>();
+ test_return_type<double, char>();
+ test_return_type<char, double>();
+
+// All the iterator categories
+ test<input_iterator <const int*> >();
+ test<forward_iterator <const int*> >();
+ test<bidirectional_iterator<const int*> >();
+ test<random_access_iterator<const int*> >();
+ test<const int*>();
+ test< int*>();
+
+// Make sure the math is done using the correct type
+ {
+ auto v = {1, 2, 3, 4, 5, 6};
+ unsigned res = std::transform_reduce(v.begin(), v.end(), 1U, std::multiplies<>(), twice<>());
+ assert(res == 46080); // 6! * 64 will not fit into a char
+ }
+}
diff --git a/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp b/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp
new file mode 100644
index 000000000000..f36b7d49410b
--- /dev/null
+++ b/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init.pass.cpp
@@ -0,0 +1,95 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <numeric>
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template <class InputIterator1, class InputIterator2, class T>
+// T transform_reduce(InputIterator1 first1, InputIterator1 last1,
+// InputIterator2 first2, T init);
+
+
+#include <numeric>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2, class T>
+void
+test(Iter1 first1, Iter1 last1, Iter2 first2, T init, T x)
+{
+ static_assert( std::is_same_v<T,
+ decltype(std::transform_reduce(first1, last1, first2, init))> );
+ assert(std::transform_reduce(first1, last1, first2, init) == x);
+}
+
+template <class SIter, class UIter>
+void
+test()
+{
+ int ia[] = {1, 2, 3, 4, 5, 6};
+ unsigned int ua[] = {2, 4, 6, 8, 10,12};
+ unsigned sa = sizeof(ia) / sizeof(ia[0]);
+ assert(sa == sizeof(ua) / sizeof(ua[0])); // just to be sure
+
+ test(SIter(ia), SIter(ia), UIter(ua), 0, 0);
+ test(UIter(ua), UIter(ua), SIter(ia), 1, 1);
+ test(SIter(ia), SIter(ia+1), UIter(ua), 0, 2);
+ test(UIter(ua), UIter(ua+1), SIter(ia), 2, 4);
+ test(SIter(ia), SIter(ia+2), UIter(ua), 0, 10);
+ test(UIter(ua), UIter(ua+2), SIter(ia), 3, 13);
+ test(SIter(ia), SIter(ia+sa), UIter(ua), 0, 182);
+ test(UIter(ua), UIter(ua+sa), SIter(ia), 4, 186);
+}
+
+template <typename T, typename Init>
+void test_return_type()
+{
+ T *p = nullptr;
+ static_assert( std::is_same_v<Init,
+ decltype(std::transform_reduce(p, p, p, Init{}))> );
+}
+
+int main()
+{
+ test_return_type<char, int>();
+ test_return_type<int, int>();
+ test_return_type<int, unsigned long>();
+ test_return_type<float, int>();
+ test_return_type<short, float>();
+ test_return_type<double, char>();
+ test_return_type<char, double>();
+
+// All the iterator categories
+ test<input_iterator <const int*>, input_iterator <const unsigned int*> >();
+ test<input_iterator <const int*>, forward_iterator <const unsigned int*> >();
+ test<input_iterator <const int*>, bidirectional_iterator<const unsigned int*> >();
+ test<input_iterator <const int*>, random_access_iterator<const unsigned int*> >();
+
+ test<forward_iterator <const int*>, input_iterator <const unsigned int*> >();
+ test<forward_iterator <const int*>, forward_iterator <const unsigned int*> >();
+ test<forward_iterator <const int*>, bidirectional_iterator<const unsigned int*> >();
+ test<forward_iterator <const int*>, random_access_iterator<const unsigned int*> >();
+
+ test<bidirectional_iterator<const int*>, input_iterator <const unsigned int*> >();
+ test<bidirectional_iterator<const int*>, forward_iterator <const unsigned int*> >();
+ test<bidirectional_iterator<const int*>, bidirectional_iterator<const unsigned int*> >();
+ test<bidirectional_iterator<const int*>, random_access_iterator<const unsigned int*> >();
+
+ test<random_access_iterator<const int*>, input_iterator <const unsigned int*> >();
+ test<random_access_iterator<const int*>, forward_iterator <const unsigned int*> >();
+ test<random_access_iterator<const int*>, bidirectional_iterator<const unsigned int*> >();
+ test<random_access_iterator<const int*>, random_access_iterator<const unsigned int*> >();
+
+// just plain pointers (const vs. non-const, too)
+ test<const int*, const unsigned int *>();
+ test<const int*, unsigned int *>();
+ test< int*, const unsigned int *>();
+ test< int*, unsigned int *>();
+}
diff --git a/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp b/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp
new file mode 100644
index 000000000000..b1b53293b991
--- /dev/null
+++ b/test/std/numerics/numeric.ops/transform.reduce/transform_reduce_iter_iter_iter_init_op_op.pass.cpp
@@ -0,0 +1,97 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <numeric>
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// template <class InputIterator1, class InputIterator2, class T,
+// class BinaryOperation1, class BinaryOperation2>
+// T transform_reduce(InputIterator1 first1, InputIterator1 last1,
+// InputIterator2 first2, T init,
+// BinaryOperation1 binary_op1, BinaryOperation2 binary_op2);
+//
+
+#include <numeric>
+#include <cassert>
+
+#include "test_iterators.h"
+
+template <class Iter1, class Iter2, class T, class Op1, class Op2>
+void
+test(Iter1 first1, Iter1 last1, Iter2 first2, T init, Op1 op1, Op2 op2, T x)
+{
+ static_assert( std::is_same_v<T,
+ decltype(std::transform_reduce(first1, last1, first2, init, op1, op2))> );
+ assert(std::transform_reduce(first1, last1, first2, init, op1, op2) == x);
+}
+
+template <class SIter, class UIter>
+void
+test()
+{
+ int ia[] = {1, 2, 3, 4, 5, 6};
+ unsigned int ua[] = {2, 4, 6, 8, 10,12};
+ unsigned sa = sizeof(ia) / sizeof(ia[0]);
+ assert(sa == sizeof(ua) / sizeof(ua[0])); // just to be sure
+
+ test(SIter(ia), SIter(ia), UIter(ua), 0, std::plus<>(), std::multiplies<>(), 0);
+ test(UIter(ua), UIter(ua), SIter(ia), 1, std::multiplies<>(), std::plus<>(), 1);
+ test(SIter(ia), SIter(ia+1), UIter(ua), 0, std::multiplies<>(), std::plus<>(), 0);
+ test(UIter(ua), UIter(ua+1), SIter(ia), 2, std::plus<>(), std::multiplies<>(), 4);
+ test(SIter(ia), SIter(ia+2), UIter(ua), 0, std::plus<>(), std::multiplies<>(), 10);
+ test(UIter(ua), UIter(ua+2), SIter(ia), 3, std::multiplies<>(), std::plus<>(), 54);
+ test(SIter(ia), SIter(ia+sa), UIter(ua), 4, std::multiplies<>(), std::plus<>(), 2099520);
+ test(UIter(ua), UIter(ua+sa), SIter(ia), 4, std::plus<>(), std::multiplies<>(), 186);
+}
+
+template <typename T, typename Init>
+void test_return_type()
+{
+ T *p = nullptr;
+ static_assert( std::is_same_v<Init,
+ decltype(std::transform_reduce(p, p, p, Init{}, std::plus<>(), std::multiplies<>()))> );
+}
+
+int main()
+{
+ test_return_type<char, int>();
+ test_return_type<int, int>();
+ test_return_type<int, unsigned long>();
+ test_return_type<float, int>();
+ test_return_type<short, float>();
+ test_return_type<double, char>();
+ test_return_type<char, double>();
+
+// All the iterator categories
+ test<input_iterator <const int*>, input_iterator <const unsigned int*> >();
+ test<input_iterator <const int*>, forward_iterator <const unsigned int*> >();
+ test<input_iterator <const int*>, bidirectional_iterator<const unsigned int*> >();
+ test<input_iterator <const int*>, random_access_iterator<const unsigned int*> >();
+
+ test<forward_iterator <const int*>, input_iterator <const unsigned int*> >();
+ test<forward_iterator <const int*>, forward_iterator <const unsigned int*> >();
+ test<forward_iterator <const int*>, bidirectional_iterator<const unsigned int*> >();
+ test<forward_iterator <const int*>, random_access_iterator<const unsigned int*> >();
+
+ test<bidirectional_iterator<const int*>, input_iterator <const unsigned int*> >();
+ test<bidirectional_iterator<const int*>, forward_iterator <const unsigned int*> >();
+ test<bidirectional_iterator<const int*>, bidirectional_iterator<const unsigned int*> >();
+ test<bidirectional_iterator<const int*>, random_access_iterator<const unsigned int*> >();
+
+ test<random_access_iterator<const int*>, input_iterator <const unsigned int*> >();
+ test<random_access_iterator<const int*>, forward_iterator <const unsigned int*> >();
+ test<random_access_iterator<const int*>, bidirectional_iterator<const unsigned int*> >();
+ test<random_access_iterator<const int*>, random_access_iterator<const unsigned int*> >();
+
+// just plain pointers (const vs. non-const, too)
+ test<const int*, const unsigned int *>();
+ test<const int*, unsigned int *>();
+ test< int*, const unsigned int *>();
+ test< int*, unsigned int *>();
+}
diff --git a/test/support/allocators.h b/test/support/allocators.h
index b1eea8d0b683..00e9a0c13ce7 100644
--- a/test/support/allocators.h
+++ b/test/support/allocators.h
@@ -104,7 +104,7 @@ public:
T* allocate(std::size_t, const void* hint)
{
allocate_called = true;
- return (T*)hint;
+ return (T*) const_cast<void *>(hint);
}
};
diff --git a/test/support/is_transparent.h b/test/support/is_transparent.h
index 541689314b8b..f7cdbbc14ccd 100644
--- a/test/support/is_transparent.h
+++ b/test/support/is_transparent.h
@@ -22,7 +22,17 @@ struct transparent_less
noexcept(noexcept(std::forward<T>(t) < std::forward<U>(u)))
-> decltype (std::forward<T>(t) < std::forward<U>(u))
{ return std::forward<T>(t) < std::forward<U>(u); }
- typedef void is_transparent; // correct
+ using is_transparent = void; // correct
+};
+
+struct transparent_less_not_referenceable
+{
+ template <class T, class U>
+ constexpr auto operator()(T&& t, U&& u) const
+ noexcept(noexcept(std::forward<T>(t) < std::forward<U>(u)))
+ -> decltype (std::forward<T>(t) < std::forward<U>(u))
+ { return std::forward<T>(t) < std::forward<U>(u); }
+ using is_transparent = void () const &; // it's a type; a weird one, but a type
};
struct transparent_less_no_type
@@ -33,7 +43,7 @@ struct transparent_less_no_type
-> decltype (std::forward<T>(t) < std::forward<U>(u))
{ return std::forward<T>(t) < std::forward<U>(u); }
private:
-// typedef void is_transparent; // error - should exist
+// using is_transparent = void; // error - should exist
};
struct transparent_less_private
@@ -44,7 +54,7 @@ struct transparent_less_private
-> decltype (std::forward<T>(t) < std::forward<U>(u))
{ return std::forward<T>(t) < std::forward<U>(u); }
private:
- typedef void is_transparent; // error - should be accessible
+ using is_transparent = void; // error - should be accessible
};
struct transparent_less_not_a_type