[libcxx-commits] [libcxx] [libc++][C++03] Split libc++-specific tests for the frozen headers (PR #144093)
via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Aug 11 02:37:58 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp libcxx/test/libcxx-03/algorithms/bad_iterator_traits.verify.cpp libcxx/test/libcxx-03/algorithms/half_positive.pass.cpp libcxx/test/libcxx-03/algorithms/pstl.libdispatch.chunk_partitions.pass.cpp libcxx/test/libcxx-03/algorithms/robust_against_copying_comparators.pass.cpp libcxx/test/libcxx-03/algorithms/robust_against_cpp20_hostile_iterators.compile.pass.cpp libcxx/test/libcxx-03/algorithms/robust_against_using_non_transparent_comparators.pass.cpp libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp libcxx/test/libcxx-03/assertions/customize_verbose_abort.link-time.pass.cpp libcxx/test/libcxx-03/assertions/default_verbose_abort.pass.cpp libcxx/test/libcxx-03/assertions/modes/hardening_mode_incorrect_value.sh.cpp libcxx/test/libcxx-03/assertions/modes/none.pass.cpp libcxx/test/libcxx-03/assertions/single_expression.pass.cpp libcxx/test/libcxx-03/atomics/atomics.order/memory_order.underlying_type.pass.cpp libcxx/test/libcxx-03/atomics/atomics.syn/incompatible_with_stdatomic.verify.cpp libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp libcxx/test/libcxx-03/atomics/diagnose_invalid_memory_order.verify.cpp libcxx/test/libcxx-03/atomics/stdatomic.h.syn/dont_hijack_header.compile.pass.cpp libcxx/test/libcxx-03/atomics/stdatomic.h.syn/dont_hijack_header.cxx23.compile.pass.cpp libcxx/test/libcxx-03/containers/associative/map/at.abort.pass.cpp libcxx/test/libcxx-03/containers/associative/map/at.const.abort.pass.cpp libcxx/test/libcxx-03/containers/associative/reference_comparator_abi.compile.pass.cpp libcxx/test/libcxx-03/containers/associative/tree_balance_after_insert.pass.cpp libcxx/test/libcxx-03/containers/associative/tree_key_value_traits.pass.cpp libcxx/test/libcxx-03/containers/associative/tree_left_rotate.pass.cpp libcxx/test/libcxx-03/containers/associative/tree_remove.pass.cpp libcxx/test/libcxx-03/containers/associative/tree_right_rotate.pass.cpp libcxx/test/libcxx-03/containers/associative/unord.map/abi.compile.pass.cpp libcxx/test/libcxx-03/containers/associative/unord.set/abi.compile.pass.cpp libcxx/test/libcxx-03/containers/container_traits.compile.pass.cpp libcxx/test/libcxx-03/containers/sequences/array/triviality.pass.cpp libcxx/test/libcxx-03/containers/sequences/deque/abi.compile.pass.cpp libcxx/test/libcxx-03/containers/sequences/deque/asan.pass.cpp libcxx/test/libcxx-03/containers/sequences/deque/asan_caterpillar.pass.cpp libcxx/test/libcxx-03/containers/sequences/deque/segmented_iterator.compile.pass.cpp libcxx/test/libcxx-03/containers/sequences/list/abi.compile.pass.cpp libcxx/test/libcxx-03/containers/sequences/vector.bool/abi.compile.pass.cpp libcxx/test/libcxx-03/containers/sequences/vector/abi.compile.pass.cpp libcxx/test/libcxx-03/containers/sequences/vector/asan.pass.cpp libcxx/test/libcxx-03/containers/sequences/vector/asan_throw.pass.cpp libcxx/test/libcxx-03/containers/sequences/vector/invalid_allocator.verify.cpp libcxx/test/libcxx-03/containers/unord/key_value_traits.pass.cpp libcxx/test/libcxx-03/containers/unord/next_prime.pass.cpp libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/address.cxx20.pass.cpp libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/allocate.cxx20.pass.cpp libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/construct.cxx20.pass.cpp libcxx/test/libcxx-03/depr/depr.default.allocator/allocator.members/max_size.cxx20.pass.cpp libcxx/test/libcxx-03/depr/depr.default.allocator/allocator_types.cxx20.pass.cpp libcxx/test/libcxx-03/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp libcxx/test/libcxx-03/depr/exception.unexpected/get_unexpected.pass.cpp libcxx/test/libcxx-03/depr/exception.unexpected/set_unexpected.pass.cpp libcxx/test/libcxx-03/depr/exception.unexpected/unexpected.pass.cpp libcxx/test/libcxx-03/diagnostics/system_error_win_codes.pass.cpp libcxx/test/libcxx-03/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.close.pass.cpp libcxx/test/libcxx-03/input.output/file.streams/fstreams/traits_mismatch.verify.cpp libcxx/test/libcxx-03/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp libcxx/test/libcxx-03/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp libcxx/test/libcxx-03/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp libcxx/test/libcxx-03/input.output/iostreams.base/ios/iostate.flags/clear.abort.pass.cpp libcxx/test/libcxx-03/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp libcxx/test/libcxx-03/input.output/string.streams/traits_mismatch.verify.cpp libcxx/test/libcxx-03/iterators/aliasing_iterator.pass.cpp libcxx/test/libcxx-03/iterators/bounded_iter/arithmetic.pass.cpp libcxx/test/libcxx-03/iterators/bounded_iter/comparison.pass.cpp libcxx/test/libcxx-03/iterators/bounded_iter/pointer_traits.pass.cpp libcxx/test/libcxx-03/iterators/bounded_iter/types.compile.pass.cpp libcxx/test/libcxx-03/iterators/contiguous_iterators.conv.compile.pass.cpp libcxx/test/libcxx-03/iterators/contiguous_iterators.pass.cpp libcxx/test/libcxx-03/iterators/contiguous_iterators.verify.cpp libcxx/test/libcxx-03/iterators/iterator.primitives/iterator.operations/prev.verify.cpp libcxx/test/libcxx-03/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/get_container.pass.cpp libcxx/test/libcxx-03/iterators/unwrap_iter.pass.cpp libcxx/test/libcxx-03/language.support/support.dynamic/libcpp_deallocate.sh.cpp libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.apple.compile.pass.cpp libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp libcxx/test/libcxx-03/libcpp_alignof.pass.cpp libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp libcxx/test/libcxx-03/localization/locale.categories/__scan_keyword.pass.cpp libcxx/test/libcxx-03/localization/locales/locale.abort.pass.cpp libcxx/test/libcxx-03/localization/locales/locale.category.abort.pass.cpp libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/no_allocation.pass.cpp libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.id/id.pass.cpp libcxx/test/libcxx-03/localization/locales/use_facet.abort.pass.cpp libcxx/test/libcxx-03/memory/allocation_guard.pass.cpp libcxx/test/libcxx-03/memory/allocator_void.trivial.compile.pass.cpp libcxx/test/libcxx-03/memory/allocator_volatile.verify.cpp libcxx/test/libcxx-03/memory/is_allocator.pass.cpp libcxx/test/libcxx-03/memory/swap_allocator.pass.cpp libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_arg.pass.cpp libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_ret.pass.cpp libcxx/test/libcxx-03/memory/trivial_abi/weak_ptr_ret.pass.cpp libcxx/test/libcxx-03/memory/uninitialized_allocator_copy.pass.cpp libcxx/test/libcxx-03/numerics/bit.ops.pass.cpp libcxx/test/libcxx-03/numerics/clamp_to_integral.pass.cpp libcxx/test/libcxx-03/numerics/complex.number/__sqr.pass.cpp libcxx/test/libcxx-03/numerics/complex.number/cmplx.over.pow.pass.cpp libcxx/test/libcxx-03/numerics/numarray/class.gslice.array/get.pass.cpp libcxx/test/libcxx-03/numerics/numarray/class.indirect.array/get.pass.cpp libcxx/test/libcxx-03/numerics/numarray/class.mask.array/get.pass.cpp libcxx/test/libcxx-03/numerics/numarray/class.slice.array/get.pass.cpp libcxx/test/libcxx-03/numerics/rand/rand.device/has-no-random-device.verify.cpp libcxx/test/libcxx-03/strings/basic.string/sizeof.compile.pass.cpp libcxx/test/libcxx-03/strings/basic.string/string.capacity/allocation_size.pass.cpp libcxx/test/libcxx-03/strings/basic.string/string.capacity/max_size.pass.cpp libcxx/test/libcxx-03/strings/basic.string/string.cons/copy_shrunk_long.pass.cpp libcxx/test/libcxx-03/strings/basic.string/string.modifiers/resize_default_initialized.pass.cpp libcxx/test/libcxx-03/strings/c.strings/constexpr_memmove.pass.cpp libcxx/test/libcxx-03/strings/string.view/string.view.iterators/assert.iterator-indexing.pass.cpp libcxx/test/libcxx-03/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/types.pass.cpp libcxx/test/libcxx-03/type_traits/convert_to_integral.pass.cpp libcxx/test/libcxx-03/type_traits/datasizeof.compile.pass.cpp libcxx/test/libcxx-03/type_traits/desugars_to.compile.pass.cpp libcxx/test/libcxx-03/type_traits/is_callable.compile.pass.cpp libcxx/test/libcxx-03/type_traits/is_constant_evaluated.pass.cpp libcxx/test/libcxx-03/type_traits/is_replaceable.compile.pass.cpp libcxx/test/libcxx-03/type_traits/is_trivially_comparable.compile.pass.cpp libcxx/test/libcxx-03/type_traits/is_trivially_relocatable.compile.pass.cpp libcxx/test/libcxx-03/utilities/exception_guard.odr.sh.cpp libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_7.pass.cpp libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke.pass.cpp libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke_helpers.h libcxx/test/libcxx-03/utilities/function.objects/refwrap/desugars_to.compile.pass.cpp libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.binary.compile.pass.cpp libcxx/test/libcxx-03/utilities/function.objects/unord.hash/murmur2_or_cityhash_ubsan_unsigned_overflow_ignored.pass.cpp libcxx/test/libcxx-03/utilities/is_pointer_in_range.pass.cpp libcxx/test/libcxx-03/utilities/is_valid_range.pass.cpp libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address.pass.cpp libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_funcptr.verify.cpp libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_function.verify.cpp libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_std_iterators.pass.cpp libcxx/test/libcxx-03/utilities/meta/is_referenceable.compile.pass.cpp libcxx/test/libcxx-03/utilities/meta/meta_base.pass.cpp libcxx/test/libcxx-03/utilities/no_destroy.pass.cpp libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivially_copyable.compile.pass.cpp libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.incomplete.compile.pass.cpp libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.tuple_element.verify.cpp libcxx/test/libcxx-03/utilities/utility/private_constructor_tag.compile.pass.cpp libcxx/test/libcxx-03/vendor/apple/availability-with-pedantic-errors.compile.pass.cpp libcxx/test/libcxx-03/vendor/apple/disable-availability.sh.cpp libcxx/test/libcxx-03/vendor/apple/system-install-properties.sh.cpp libcxx/test/libcxx-03/vendor/clang-cl/static-lib-exports.sh.cpp libcxx/test/libcxx-03/vendor/mingw/static-lib-exports.sh.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp b/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
index 4e51014f2..205fb1919 100644
--- a/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
+++ b/libcxx/test/libcxx-03/algorithms/alg.modifying.operations/alg.random.shuffle/random_shuffle.cxx1z.pass.cpp
@@ -31,21 +31,15 @@
#include "test_macros.h"
-struct gen
-{
- std::ptrdiff_t operator()(std::ptrdiff_t n)
- {
- return n-1;
- }
+struct gen {
+ std::ptrdiff_t operator()(std::ptrdiff_t n) { return n - 1; }
};
-
-int main(int, char**)
-{
- std::vector<int> v;
- std::random_shuffle(v.begin(), v.end());
- gen r;
- std::random_shuffle(v.begin(), v.end(), r);
+int main(int, char**) {
+ std::vector<int> v;
+ std::random_shuffle(v.begin(), v.end());
+ gen r;
+ std::random_shuffle(v.begin(), v.end(), r);
return 0;
}
diff --git a/libcxx/test/libcxx-03/algorithms/bad_iterator_traits.verify.cpp b/libcxx/test/libcxx-03/algorithms/bad_iterator_traits.verify.cpp
index a0b5b88bb..974bcd6d1 100644
--- a/libcxx/test/libcxx-03/algorithms/bad_iterator_traits.verify.cpp
+++ b/libcxx/test/libcxx-03/algorithms/bad_iterator_traits.verify.cpp
@@ -17,18 +17,18 @@ struct BadIter {
struct Value {
friend bool operator==(const Value& x, const Value& y);
friend bool operator!=(const Value& x, const Value& y);
- friend bool operator< (const Value& x, const Value& y);
+ friend bool operator<(const Value& x, const Value& y);
friend bool operator<=(const Value& x, const Value& y);
- friend bool operator> (const Value& x, const Value& y);
+ friend bool operator>(const Value& x, const Value& y);
friend bool operator>=(const Value& x, const Value& y);
friend void swap(Value, Value);
};
using iterator_category = std::random_access_iterator_tag;
- using value_type = Value;
- using reference = Value&;
- using difference_type = long;
- using pointer = Value*;
+ using value_type = Value;
+ using reference = Value&;
+ using difference_type = long;
+ using pointer = Value*;
Value operator*() const; // Not `Value&`.
reference operator[](difference_type n) const;
@@ -47,9 +47,9 @@ struct BadIter {
friend bool operator==(const BadIter& x, const BadIter& y);
friend bool operator!=(const BadIter& x, const BadIter& y);
- friend bool operator< (const BadIter& x, const BadIter& y);
+ friend bool operator<(const BadIter& x, const BadIter& y);
friend bool operator<=(const BadIter& x, const BadIter& y);
- friend bool operator> (const BadIter& x, const BadIter& y);
+ friend bool operator>(const BadIter& x, const BadIter& y);
friend bool operator>=(const BadIter& x, const BadIter& y);
};
diff --git a/libcxx/test/libcxx-03/algorithms/half_positive.pass.cpp b/libcxx/test/libcxx-03/algorithms/half_positive.pass.cpp
index 88a18e859..21da05caa 100644
--- a/libcxx/test/libcxx-03/algorithms/half_positive.pass.cpp
+++ b/libcxx/test/libcxx-03/algorithms/half_positive.pass.cpp
@@ -25,34 +25,33 @@ namespace {
template <class IntType, class UnderlyingType = IntType>
TEST_CONSTEXPR bool test(IntType max_v = IntType(std::numeric_limits<UnderlyingType>::max())) {
- return std::__half_positive(max_v) == max_v / 2;
+ return std::__half_positive(max_v) == max_v / 2;
}
-} // namespace
+} // namespace
-int main(int, char**)
-{
- {
- assert(test<char>());
- assert(test<int>());
- assert(test<long>());
- assert((test<UserDefinedIntegral<int>, int>()));
- assert(test<std::size_t>());
+int main(int, char**) {
+ {
+ assert(test<char>());
+ assert(test<int>());
+ assert(test<long>());
+ assert((test<UserDefinedIntegral<int>, int>()));
+ assert(test<std::size_t>());
#if !defined(TEST_HAS_NO_INT128)
- assert(test<__int128_t>());
+ assert(test<__int128_t>());
#endif // !defined(TEST_HAS_NO_INT128)
- }
+ }
#if TEST_STD_VER >= 11
- {
- static_assert(test<char>(), "");
- static_assert(test<int>(), "");
- static_assert(test<long>(), "");
- static_assert(test<std::size_t>(), "");
-#if !defined(TEST_HAS_NO_INT128)
- static_assert(test<__int128_t>(), "");
-#endif // !defined(TEST_HAS_NO_INT128)
- }
+ {
+ static_assert(test<char>(), "");
+ static_assert(test<int>(), "");
+ static_assert(test<long>(), "");
+ static_assert(test<std::size_t>(), "");
+# if !defined(TEST_HAS_NO_INT128)
+ static_assert(test<__int128_t>(), "");
+# endif // !defined(TEST_HAS_NO_INT128)
+ }
#endif // TEST_STD_VER >= 11
return 0;
diff --git a/libcxx/test/libcxx-03/algorithms/robust_against_cpp20_hostile_iterators.compile.pass.cpp b/libcxx/test/libcxx-03/algorithms/robust_against_cpp20_hostile_iterators.compile.pass.cpp
index 03fef57ee..eb7209f13 100644
--- a/libcxx/test/libcxx-03/algorithms/robust_against_cpp20_hostile_iterators.compile.pass.cpp
+++ b/libcxx/test/libcxx-03/algorithms/robust_against_cpp20_hostile_iterators.compile.pass.cpp
@@ -19,12 +19,12 @@
template <class Sub, class Iterator>
struct IteratorAdaptorBase {
- using OutTraits = std::iterator_traits<Iterator>;
+ using OutTraits = std::iterator_traits<Iterator>;
using iterator_category = typename OutTraits::iterator_category;
- using value_type = typename OutTraits::value_type;
- using pointer = typename OutTraits::pointer;
- using reference = typename OutTraits::reference;
- using difference_type = typename OutTraits::difference_type;
+ using value_type = typename OutTraits::value_type;
+ using pointer = typename OutTraits::pointer;
+ using reference = typename OutTraits::reference;
+ using difference_type = typename OutTraits::difference_type;
IteratorAdaptorBase() {}
IteratorAdaptorBase(Iterator) {}
@@ -61,13 +61,12 @@ struct IteratorAdaptorBase {
friend bool operator<=(Sub, Sub) { return false; }
friend bool operator>=(Sub, Sub) { return false; }
- private:
+private:
Iterator it_;
};
template <typename It>
-struct Cpp20HostileIterator
- : IteratorAdaptorBase<Cpp20HostileIterator<It>, It> {
+struct Cpp20HostileIterator : IteratorAdaptorBase<Cpp20HostileIterator<It>, It> {
Cpp20HostileIterator() {}
Cpp20HostileIterator(It) {}
};
@@ -83,143 +82,143 @@ void test() {
Pred pred;
std::mt19937_64 rng;
- (void) std::adjacent_find(it, it);
- (void) std::adjacent_find(it, it, pred);
- (void) std::all_of(it, it, pred);
- (void) std::any_of(it, it, pred);
- (void) std::binary_search(it, it, 0);
- (void) std::binary_search(it, it, 0, pred);
- (void) std::copy_backward(it, it, it);
- (void) std::copy_if(it, it, it, pred);
- (void) std::copy_n(it, 0, it);
- (void) std::copy(it, it, it);
- (void) std::count_if(it, it, pred);
- (void) std::count(it, it, 0);
- (void) std::equal_range(it, it, 0);
- (void) std::equal_range(it, it, 0, pred);
- (void) std::equal(it, it, it);
- (void) std::equal(it, it, it, pred);
+ (void)std::adjacent_find(it, it);
+ (void)std::adjacent_find(it, it, pred);
+ (void)std::all_of(it, it, pred);
+ (void)std::any_of(it, it, pred);
+ (void)std::binary_search(it, it, 0);
+ (void)std::binary_search(it, it, 0, pred);
+ (void)std::copy_backward(it, it, it);
+ (void)std::copy_if(it, it, it, pred);
+ (void)std::copy_n(it, 0, it);
+ (void)std::copy(it, it, it);
+ (void)std::count_if(it, it, pred);
+ (void)std::count(it, it, 0);
+ (void)std::equal_range(it, it, 0);
+ (void)std::equal_range(it, it, 0, pred);
+ (void)std::equal(it, it, it);
+ (void)std::equal(it, it, it, pred);
#if TEST_STD_VER > 11
- (void) std::equal(it, it, it, it);
- (void) std::equal(it, it, it, it, pred);
+ (void)std::equal(it, it, it, it);
+ (void)std::equal(it, it, it, it, pred);
#endif
- (void) std::fill_n(it, 0, 0);
- (void) std::fill(it, it, 0);
- (void) std::find_end(it, it, it, it);
- (void) std::find_end(it, it, it, it, pred);
- (void) std::find_first_of(it, it, it, it);
- (void) std::find_first_of(it, it, it, it, pred);
- (void) std::find_if_not(it, it, pred);
- (void) std::find_if(it, it, pred);
- (void) std::find(it, it, 0);
+ (void)std::fill_n(it, 0, 0);
+ (void)std::fill(it, it, 0);
+ (void)std::find_end(it, it, it, it);
+ (void)std::find_end(it, it, it, it, pred);
+ (void)std::find_first_of(it, it, it, it);
+ (void)std::find_first_of(it, it, it, it, pred);
+ (void)std::find_if_not(it, it, pred);
+ (void)std::find_if(it, it, pred);
+ (void)std::find(it, it, 0);
#if TEST_STD_VER > 14
- (void) std::for_each_n(it, 0, pred);
+ (void)std::for_each_n(it, 0, pred);
#endif
- (void) std::for_each(it, it, pred);
- (void) std::generate_n(it, 0, pred);
- (void) std::generate(it, it, pred);
- (void) std::includes(it, it, it, it);
- (void) std::includes(it, it, it, it, pred);
- (void) std::inplace_merge(it, it, it);
- (void) std::inplace_merge(it, it, it, pred);
- (void) std::is_heap_until(it, it);
- (void) std::is_heap_until(it, it, pred);
- (void) std::is_heap(it, it);
- (void) std::is_heap(it, it, pred);
- (void) std::is_partitioned(it, it, pred);
- (void) std::is_permutation(it, it, it);
- (void) std::is_permutation(it, it, it, pred);
+ (void)std::for_each(it, it, pred);
+ (void)std::generate_n(it, 0, pred);
+ (void)std::generate(it, it, pred);
+ (void)std::includes(it, it, it, it);
+ (void)std::includes(it, it, it, it, pred);
+ (void)std::inplace_merge(it, it, it);
+ (void)std::inplace_merge(it, it, it, pred);
+ (void)std::is_heap_until(it, it);
+ (void)std::is_heap_until(it, it, pred);
+ (void)std::is_heap(it, it);
+ (void)std::is_heap(it, it, pred);
+ (void)std::is_partitioned(it, it, pred);
+ (void)std::is_permutation(it, it, it);
+ (void)std::is_permutation(it, it, it, pred);
#if TEST_STD_VER > 11
- (void) std::is_permutation(it, it, it, it);
- (void) std::is_permutation(it, it, it, it, pred);
+ (void)std::is_permutation(it, it, it, it);
+ (void)std::is_permutation(it, it, it, it, pred);
#endif
- (void) std::is_sorted_until(it, it);
- (void) std::is_sorted_until(it, it, pred);
- (void) std::is_sorted(it, it);
- (void) std::is_sorted(it, it, pred);
- (void) std::lexicographical_compare(it, it, it, it);
- (void) std::lexicographical_compare(it, it, it, it, pred);
+ (void)std::is_sorted_until(it, it);
+ (void)std::is_sorted_until(it, it, pred);
+ (void)std::is_sorted(it, it);
+ (void)std::is_sorted(it, it, pred);
+ (void)std::lexicographical_compare(it, it, it, it);
+ (void)std::lexicographical_compare(it, it, it, it, pred);
#if TEST_STD_VER > 17
(void)std::lexicographical_compare_three_way(it, it, it, it);
(void)std::lexicographical_compare_three_way(it, it, it, it, std::compare_three_way());
#endif
- (void) std::lower_bound(it, it, 0);
- (void) std::lower_bound(it, it, 0, pred);
- (void) std::make_heap(it, it);
- (void) std::make_heap(it, it, pred);
- (void) std::max_element(it, it);
- (void) std::max_element(it, it, pred);
- (void) std::merge(it, it, it, it, it);
- (void) std::merge(it, it, it, it, it, pred);
- (void) std::min_element(it, it);
- (void) std::min_element(it, it, pred);
- (void) std::minmax_element(it, it);
- (void) std::minmax_element(it, it, pred);
- (void) std::mismatch(it, it, it);
- (void) std::mismatch(it, it, it, pred);
- (void) std::move_backward(it, it, it);
- (void) std::move(it, it, it);
- (void) std::next_permutation(it, it);
- (void) std::next_permutation(it, it, pred);
- (void) std::none_of(it, it, pred);
- (void) std::nth_element(it, it, it);
- (void) std::nth_element(it, it, it, pred);
- (void) std::partial_sort_copy(it, it, it, it);
- (void) std::partial_sort_copy(it, it, it, it, pred);
- (void) std::partial_sort(it, it, it);
- (void) std::partial_sort(it, it, it, pred);
- (void) std::partition_copy(it, it, it, it, pred);
- (void) std::partition_point(it, it, pred);
- (void) std::partition(it, it, pred);
- (void) std::pop_heap(it, it);
- (void) std::pop_heap(it, it, pred);
- (void) std::prev_permutation(it, it);
- (void) std::prev_permutation(it, it, pred);
- (void) std::push_heap(it, it);
- (void) std::push_heap(it, it, pred);
- (void) std::remove_copy_if(it, it, it, pred);
- (void) std::remove_copy(it, it, it, 0);
- (void) std::remove_if(it, it, pred);
- (void) std::remove(it, it, 0);
- (void) std::replace_copy_if(it, it, it, pred, 0);
- (void) std::replace_copy(it, it, it, 0, 0);
- (void) std::replace_if(it, it, pred, 0);
- (void) std::replace(it, it, 0, 0);
- (void) std::reverse_copy(it, it, it);
- (void) std::reverse(it, it);
- (void) std::rotate_copy(it, it, it, it);
- (void) std::rotate(it, it, it);
+ (void)std::lower_bound(it, it, 0);
+ (void)std::lower_bound(it, it, 0, pred);
+ (void)std::make_heap(it, it);
+ (void)std::make_heap(it, it, pred);
+ (void)std::max_element(it, it);
+ (void)std::max_element(it, it, pred);
+ (void)std::merge(it, it, it, it, it);
+ (void)std::merge(it, it, it, it, it, pred);
+ (void)std::min_element(it, it);
+ (void)std::min_element(it, it, pred);
+ (void)std::minmax_element(it, it);
+ (void)std::minmax_element(it, it, pred);
+ (void)std::mismatch(it, it, it);
+ (void)std::mismatch(it, it, it, pred);
+ (void)std::move_backward(it, it, it);
+ (void)std::move(it, it, it);
+ (void)std::next_permutation(it, it);
+ (void)std::next_permutation(it, it, pred);
+ (void)std::none_of(it, it, pred);
+ (void)std::nth_element(it, it, it);
+ (void)std::nth_element(it, it, it, pred);
+ (void)std::partial_sort_copy(it, it, it, it);
+ (void)std::partial_sort_copy(it, it, it, it, pred);
+ (void)std::partial_sort(it, it, it);
+ (void)std::partial_sort(it, it, it, pred);
+ (void)std::partition_copy(it, it, it, it, pred);
+ (void)std::partition_point(it, it, pred);
+ (void)std::partition(it, it, pred);
+ (void)std::pop_heap(it, it);
+ (void)std::pop_heap(it, it, pred);
+ (void)std::prev_permutation(it, it);
+ (void)std::prev_permutation(it, it, pred);
+ (void)std::push_heap(it, it);
+ (void)std::push_heap(it, it, pred);
+ (void)std::remove_copy_if(it, it, it, pred);
+ (void)std::remove_copy(it, it, it, 0);
+ (void)std::remove_if(it, it, pred);
+ (void)std::remove(it, it, 0);
+ (void)std::replace_copy_if(it, it, it, pred, 0);
+ (void)std::replace_copy(it, it, it, 0, 0);
+ (void)std::replace_if(it, it, pred, 0);
+ (void)std::replace(it, it, 0, 0);
+ (void)std::reverse_copy(it, it, it);
+ (void)std::reverse(it, it);
+ (void)std::rotate_copy(it, it, it, it);
+ (void)std::rotate(it, it, it);
#if TEST_STD_VER > 14
- (void) std::sample(it, it, it, 0, rng);
+ (void)std::sample(it, it, it, 0, rng);
#endif
- (void) std::search(it, it, it, it);
- (void) std::search(it, it, it, it, pred);
+ (void)std::search(it, it, it, it);
+ (void)std::search(it, it, it, it, pred);
#if TEST_STD_VER > 14
- (void) std::search(it, it, std::default_searcher<Cpp20HostileIterator<int*>>(it, it));
+ (void)std::search(it, it, std::default_searcher<Cpp20HostileIterator<int*>>(it, it));
#endif
- (void) std::set_difference(it, it, it, it, it);
- (void) std::set_difference(it, it, it, it, it, pred);
- (void) std::set_intersection(it, it, it, it, it);
- (void) std::set_intersection(it, it, it, it, it, pred);
- (void) std::set_symmetric_difference(it, it, it, it, it);
- (void) std::set_symmetric_difference(it, it, it, it, it, pred);
- (void) std::set_union(it, it, it, it, it);
- (void) std::set_union(it, it, it, it, it, pred);
+ (void)std::set_difference(it, it, it, it, it);
+ (void)std::set_difference(it, it, it, it, it, pred);
+ (void)std::set_intersection(it, it, it, it, it);
+ (void)std::set_intersection(it, it, it, it, it, pred);
+ (void)std::set_symmetric_difference(it, it, it, it, it);
+ (void)std::set_symmetric_difference(it, it, it, it, it, pred);
+ (void)std::set_union(it, it, it, it, it);
+ (void)std::set_union(it, it, it, it, it, pred);
#if TEST_STD_VER > 17
- (void) std::shift_left(it, it, 0);
- (void) std::shift_right(it, it, 0);
+ (void)std::shift_left(it, it, 0);
+ (void)std::shift_right(it, it, 0);
#endif
- (void) std::shuffle(it, it, rng);
- (void) std::sort_heap(it, it);
- (void) std::sort_heap(it, it, pred);
- (void) std::sort(it, it);
- (void) std::sort(it, it, pred);
- (void) std::stable_partition(it, it, pred);
- (void) std::stable_sort(it, it);
- (void) std::swap_ranges(it, it, it);
- (void) std::transform(it, it, it, pred);
- (void) std::transform(it, it, it, it, pred);
- (void) std::unique_copy(it, it, it);
- (void) std::unique(it, it);
- (void) std::upper_bound(it, it, 0);
+ (void)std::shuffle(it, it, rng);
+ (void)std::sort_heap(it, it);
+ (void)std::sort_heap(it, it, pred);
+ (void)std::sort(it, it);
+ (void)std::sort(it, it, pred);
+ (void)std::stable_partition(it, it, pred);
+ (void)std::stable_sort(it, it);
+ (void)std::swap_ranges(it, it, it);
+ (void)std::transform(it, it, it, pred);
+ (void)std::transform(it, it, it, it, pred);
+ (void)std::unique_copy(it, it, it);
+ (void)std::unique(it, it);
+ (void)std::upper_bound(it, it, 0);
}
diff --git a/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp b/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp
index 69154c3f7..688715eee 100644
--- a/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp
+++ b/libcxx/test/libcxx-03/assertions/customize_verbose_abort.compile-time.pass.cpp
@@ -17,9 +17,7 @@
#include <cstdlib>
-void my_abort(char const*, ...) {
- std::exit(EXIT_SUCCESS);
-}
+void my_abort(char const*, ...) { std::exit(EXIT_SUCCESS); }
int main(int, char**) {
_LIBCPP_VERBOSE_ABORT("%s", "message");
diff --git a/libcxx/test/libcxx-03/atomics/atomics.order/memory_order.underlying_type.pass.cpp b/libcxx/test/libcxx-03/atomics/atomics.order/memory_order.underlying_type.pass.cpp
index 5379ef878..7977b1891 100644
--- a/libcxx/test/libcxx-03/atomics/atomics.order/memory_order.underlying_type.pass.cpp
+++ b/libcxx/test/libcxx-03/atomics/atomics.order/memory_order.underlying_type.pass.cpp
@@ -18,17 +18,18 @@
#include "test_macros.h"
-
enum cpp17_memory_order {
- cpp17_memory_order_relaxed, cpp17_memory_order_consume, cpp17_memory_order_acquire,
- cpp17_memory_order_release, cpp17_memory_order_acq_rel, cpp17_memory_order_seq_cst
+ cpp17_memory_order_relaxed,
+ cpp17_memory_order_consume,
+ cpp17_memory_order_acquire,
+ cpp17_memory_order_release,
+ cpp17_memory_order_acq_rel,
+ cpp17_memory_order_seq_cst
};
static_assert((std::is_same<std::underlying_type<cpp17_memory_order>::type,
std::underlying_type<std::memory_order>::type>::value),
- "std::memory_order should have the same underlying type as a corresponding "
- "unscoped enumeration would. Otherwise, our ABI changes from C++17 to C++20.");
+ "std::memory_order should have the same underlying type as a corresponding "
+ "unscoped enumeration would. Otherwise, our ABI changes from C++17 to C++20.");
-int main(int, char**) {
- return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/libcxx-03/atomics/diagnose_invalid_memory_order.verify.cpp b/libcxx/test/libcxx-03/atomics/diagnose_invalid_memory_order.verify.cpp
index 1b0b945f3..f390b84ba 100644
--- a/libcxx/test/libcxx-03/atomics/diagnose_invalid_memory_order.verify.cpp
+++ b/libcxx/test/libcxx-03/atomics/diagnose_invalid_memory_order.verify.cpp
@@ -15,108 +15,201 @@
#include <atomic>
void f() {
- std::atomic<int> x(42);
- volatile std::atomic<int>& vx = x;
- int val1 = 1; ((void)val1);
- int val2 = 2; ((void)val2);
- // load operations
- {
- x.load(std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- x.load(std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- vx.load(std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- vx.load(std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- // valid memory orders
- x.load(std::memory_order_relaxed);
- x.load(std::memory_order_consume);
- x.load(std::memory_order_acquire);
- x.load(std::memory_order_seq_cst);
- }
- {
- std::atomic_load_explicit(&x, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_load_explicit(&x, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_load_explicit(&vx, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_load_explicit(&vx, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- // valid memory orders
- std::atomic_load_explicit(&x, std::memory_order_relaxed);
- std::atomic_load_explicit(&x, std::memory_order_consume);
- std::atomic_load_explicit(&x, std::memory_order_acquire);
- std::atomic_load_explicit(&x, std::memory_order_seq_cst);
- }
- // store operations
- {
- x.store(42, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
- x.store(42, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
- x.store(42, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- vx.store(42, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
- vx.store(42, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
- vx.store(42, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- // valid memory orders
- x.store(42, std::memory_order_relaxed);
- x.store(42, std::memory_order_release);
- x.store(42, std::memory_order_seq_cst);
- }
- {
- std::atomic_store_explicit(&x, 42, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_store_explicit(&x, 42, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_store_explicit(&x, 42, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_store_explicit(&vx, 42, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_store_explicit(&vx, 42, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_store_explicit(&vx, 42, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- // valid memory orders
- std::atomic_store_explicit(&x, 42, std::memory_order_relaxed);
- std::atomic_store_explicit(&x, 42, std::memory_order_release);
- std::atomic_store_explicit(&x, 42, std::memory_order_seq_cst);
- }
- // compare exchange weak
- {
- x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- vx.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- vx.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- // valid memory orders
- x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
- x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
- x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
- x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
- // Test that the cmpxchg overload with only one memory order argument
- // does not generate any diagnostics.
- x.compare_exchange_weak(val1, val2, std::memory_order_release);
- }
- {
- std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_compare_exchange_weak_explicit(&vx, &val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_compare_exchange_weak_explicit(&vx, &val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- // valid memory orders
- std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
- std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
- std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
- std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
- }
- // compare exchange strong
- {
- x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- vx.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- vx.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- // valid memory orders
- x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
- x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
- x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
- x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
- // Test that the cmpxchg overload with only one memory order argument
- // does not generate any diagnostics.
- x.compare_exchange_strong(val1, val2, std::memory_order_release);
- }
- {
- std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_compare_exchange_strong_explicit(&vx, &val1, val2, std::memory_order_seq_cst, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
- std::atomic_compare_exchange_strong_explicit(&vx, &val1, val2, std::memory_order_seq_cst, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
- // valid memory orders
- std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
- std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
- std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
- std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
- }
+ std::atomic<int> x(42);
+ volatile std::atomic<int>& vx = x;
+ int val1 = 1;
+ ((void)val1);
+ int val2 = 2;
+ ((void)val2);
+ // load operations
+ {
+ x.load(std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ x.load(std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.load(std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.load(std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ x.load(std::memory_order_relaxed);
+ x.load(std::memory_order_consume);
+ x.load(std::memory_order_acquire);
+ x.load(std::memory_order_seq_cst);
+ }
+ {
+ std::atomic_load_explicit(
+ &x, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_load_explicit(
+ &x, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_load_explicit(
+ &vx, std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_load_explicit(
+ &vx, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ std::atomic_load_explicit(&x, std::memory_order_relaxed);
+ std::atomic_load_explicit(&x, std::memory_order_consume);
+ std::atomic_load_explicit(&x, std::memory_order_acquire);
+ std::atomic_load_explicit(&x, std::memory_order_seq_cst);
+ }
+ // store operations
+ {
+ x.store(42, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
+ x.store(42, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
+ x.store(42, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.store(42,
+ std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.store(42,
+ std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.store(42,
+ std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ x.store(42, std::memory_order_relaxed);
+ x.store(42, std::memory_order_release);
+ x.store(42, std::memory_order_seq_cst);
+ }
+ {
+ std::atomic_store_explicit(
+ &x, 42, std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_store_explicit(
+ &x, 42, std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_store_explicit(
+ &x, 42, std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_store_explicit(
+ &vx,
+ 42,
+ std::memory_order_consume); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_store_explicit(
+ &vx,
+ 42,
+ std::memory_order_acquire); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_store_explicit(
+ &vx,
+ 42,
+ std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ std::atomic_store_explicit(&x, 42, std::memory_order_relaxed);
+ std::atomic_store_explicit(&x, 42, std::memory_order_release);
+ std::atomic_store_explicit(&x, 42, std::memory_order_seq_cst);
+ }
+ // compare exchange weak
+ {
+ x.compare_exchange_weak(
+ val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ x.compare_exchange_weak(
+ val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.compare_exchange_weak(
+ val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.compare_exchange_weak(
+ val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
+ x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
+ x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
+ x.compare_exchange_weak(val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
+ // Test that the cmpxchg overload with only one memory order argument
+ // does not generate any diagnostics.
+ x.compare_exchange_weak(val1, val2, std::memory_order_release);
+ }
+ {
+ std::atomic_compare_exchange_weak_explicit(
+ &x,
+ &val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_weak_explicit(
+ &x,
+ &val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_weak_explicit(
+ &vx,
+ &val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_weak_explicit(
+ &vx,
+ &val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
+ std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
+ std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
+ std::atomic_compare_exchange_weak_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
+ }
+ // compare exchange strong
+ {
+ x.compare_exchange_strong(
+ val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ x.compare_exchange_strong(
+ val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.compare_exchange_strong(
+ val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ vx.compare_exchange_strong(
+ val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
+ x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
+ x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
+ x.compare_exchange_strong(val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
+ // Test that the cmpxchg overload with only one memory order argument
+ // does not generate any diagnostics.
+ x.compare_exchange_strong(val1, val2, std::memory_order_release);
+ }
+ {
+ std::atomic_compare_exchange_strong_explicit(
+ &x,
+ &val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_strong_explicit(
+ &x,
+ &val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_strong_explicit(
+ &vx,
+ &val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_release); // expected-warning {{memory order argument to atomic operation is invalid}}
+ std::atomic_compare_exchange_strong_explicit(
+ &vx,
+ &val1,
+ val2,
+ std::memory_order_seq_cst,
+ std::memory_order_acq_rel); // expected-warning {{memory order argument to atomic operation is invalid}}
+ // valid memory orders
+ std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_relaxed);
+ std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_consume);
+ std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_acquire);
+ std::atomic_compare_exchange_strong_explicit(&x, &val1, val2, std::memory_order_seq_cst, std::memory_order_seq_cst);
+ }
}
diff --git a/libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp b/libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
index cad0bd8b3..25488db75 100644
--- a/libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
+++ b/libcxx/test/libcxx-03/depr/depr.auto.ptr/auto.ptr/auto_ptr.cxx1z.pass.cpp
@@ -23,9 +23,8 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::auto_ptr<int> p;
+int main(int, char**) {
+ std::auto_ptr<int> p;
return 0;
}
diff --git a/libcxx/test/libcxx-03/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp b/libcxx/test/libcxx-03/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
index d212f36bb..6a848ed69 100644
--- a/libcxx/test/libcxx-03/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
+++ b/libcxx/test/libcxx-03/depr/depr.function.objects/depr.adaptors.cxx1z.pass.cpp
@@ -8,7 +8,6 @@
// <functional>
-
// In C++17, the function adapters mem_fun/mem_fun_ref, etc have been removed.
// However, for backwards compatibility, if _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
// is defined before including <functional>, then they will be restored.
@@ -33,36 +32,28 @@ struct Foo {
int sum(int a, int b) const { return a + b; }
};
-int main(int, char**)
-{
- typedef std::pointer_to_unary_function<int, int> PUF;
- typedef std::pointer_to_binary_function<int, int, int> PBF;
+int main(int, char**) {
+ typedef std::pointer_to_unary_function<int, int> PUF;
+ typedef std::pointer_to_binary_function<int, int, int> PBF;
- static_assert(
- (std::is_same<PUF, decltype((std::ptr_fun<int, int>(identity)))>::value),
- "");
- static_assert(
- (std::is_same<PBF, decltype((std::ptr_fun<int, int, int>(sum)))>::value),
- "");
+ static_assert((std::is_same<PUF, decltype((std::ptr_fun<int, int>(identity)))>::value), "");
+ static_assert((std::is_same<PBF, decltype((std::ptr_fun<int, int, int>(sum)))>::value), "");
- assert((std::ptr_fun<int, int>(identity)(4) == 4));
- assert((std::ptr_fun<int, int, int>(sum)(4, 5) == 9));
+ assert((std::ptr_fun<int, int>(identity)(4) == 4));
+ assert((std::ptr_fun<int, int, int>(sum)(4, 5) == 9));
- Foo f;
- assert((std::mem_fn(&Foo::identity)(f, 5) == 5));
- assert((std::mem_fn(&Foo::sum)(f, 5, 6) == 11));
+ Foo f;
+ assert((std::mem_fn(&Foo::identity)(f, 5) == 5));
+ assert((std::mem_fn(&Foo::sum)(f, 5, 6) == 11));
- typedef std::mem_fun_ref_t<int, Foo> MFR;
- typedef std::const_mem_fun_ref_t<int, Foo> CMFR;
+ typedef std::mem_fun_ref_t<int, Foo> MFR;
+ typedef std::const_mem_fun_ref_t<int, Foo> CMFR;
- static_assert(
- (std::is_same<MFR, decltype((std::mem_fun_ref(&Foo::zero)))>::value), "");
- static_assert((std::is_same<CMFR, decltype((std::mem_fun_ref(
- &Foo::zero_const)))>::value),
- "");
+ static_assert((std::is_same<MFR, decltype((std::mem_fun_ref(&Foo::zero)))>::value), "");
+ static_assert((std::is_same<CMFR, decltype((std::mem_fun_ref(&Foo::zero_const)))>::value), "");
- assert((std::mem_fun_ref(&Foo::zero)(f) == 0));
- assert((std::mem_fun_ref(&Foo::identity)(f, 5) == 5));
+ assert((std::mem_fun_ref(&Foo::zero)(f) == 0));
+ assert((std::mem_fun_ref(&Foo::identity)(f, 5) == 5));
return 0;
}
diff --git a/libcxx/test/libcxx-03/depr/exception.unexpected/get_unexpected.pass.cpp b/libcxx/test/libcxx-03/depr/exception.unexpected/get_unexpected.pass.cpp
index e4533a01c..668839deb 100644
--- a/libcxx/test/libcxx-03/depr/exception.unexpected/get_unexpected.pass.cpp
+++ b/libcxx/test/libcxx-03/depr/exception.unexpected/get_unexpected.pass.cpp
@@ -19,26 +19,21 @@
void f1() {}
void f2() {}
-void f3()
-{
- std::exit(0);
-}
-
-int main(int, char**)
-{
-
- std::unexpected_handler old = std::get_unexpected();
- // verify there is a previous unexpected handler
- assert(old);
- std::set_unexpected(f1);
- assert(std::get_unexpected() == f1);
- // verify f1 was replace with f2
- std::set_unexpected(f2);
- assert(std::get_unexpected() == f2);
- // verify calling original unexpected handler calls terminate
- std::set_terminate(f3);
- (*old)();
- assert(0);
+void f3() { std::exit(0); }
+
+int main(int, char**) {
+ std::unexpected_handler old = std::get_unexpected();
+ // verify there is a previous unexpected handler
+ assert(old);
+ std::set_unexpected(f1);
+ assert(std::get_unexpected() == f1);
+ // verify f1 was replace with f2
+ std::set_unexpected(f2);
+ assert(std::get_unexpected() == f2);
+ // verify calling original unexpected handler calls terminate
+ std::set_terminate(f3);
+ (*old)();
+ assert(0);
return 0;
}
diff --git a/libcxx/test/libcxx-03/depr/exception.unexpected/set_unexpected.pass.cpp b/libcxx/test/libcxx-03/depr/exception.unexpected/set_unexpected.pass.cpp
index f428790f6..c687cb752 100644
--- a/libcxx/test/libcxx-03/depr/exception.unexpected/set_unexpected.pass.cpp
+++ b/libcxx/test/libcxx-03/depr/exception.unexpected/set_unexpected.pass.cpp
@@ -19,22 +19,18 @@
void f1() {}
void f2() {}
-void f3()
-{
- std::exit(0);
-}
-
-int main(int, char**)
-{
- std::unexpected_handler old = std::set_unexpected(f1);
- // verify there is a previous unexpected handler
- assert(old);
- // verify f1 was replace with f2
- assert(std::set_unexpected(f2) == f1);
- // verify calling original unexpected handler calls terminate
- std::set_terminate(f3);
- (*old)();
- assert(0);
+void f3() { std::exit(0); }
+
+int main(int, char**) {
+ std::unexpected_handler old = std::set_unexpected(f1);
+ // verify there is a previous unexpected handler
+ assert(old);
+ // verify f1 was replace with f2
+ assert(std::set_unexpected(f2) == f1);
+ // verify calling original unexpected handler calls terminate
+ std::set_terminate(f3);
+ (*old)();
+ assert(0);
return 0;
}
diff --git a/libcxx/test/libcxx-03/depr/exception.unexpected/unexpected.pass.cpp b/libcxx/test/libcxx-03/depr/exception.unexpected/unexpected.pass.cpp
index 6ab1147b9..3da9e6751 100644
--- a/libcxx/test/libcxx-03/depr/exception.unexpected/unexpected.pass.cpp
+++ b/libcxx/test/libcxx-03/depr/exception.unexpected/unexpected.pass.cpp
@@ -16,16 +16,12 @@
#include "test_macros.h"
-void fexit()
-{
- std::exit(0);
-}
+void fexit() { std::exit(0); }
-int main(int, char**)
-{
- std::set_unexpected(fexit);
- std::unexpected();
- assert(false);
+int main(int, char**) {
+ std::set_unexpected(fexit);
+ std::unexpected();
+ assert(false);
return 0;
}
diff --git a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.close.pass.cpp b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.close.pass.cpp
index d77d5370f..9069a305e 100644
--- a/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.close.pass.cpp
+++ b/libcxx/test/libcxx-03/input.output/file.streams/fstreams/fstream.close.pass.cpp
@@ -20,19 +20,18 @@
#include "test_macros.h"
#include "platform_support.h"
-int main(int, char**)
-{
- std::string temp = get_temp_file_name();
+int main(int, char**) {
+ std::string temp = get_temp_file_name();
- std::fstream ofs(temp, std::ios::out | std::ios::trunc);
- ofs << "Hello, World!\n";
- assert( ofs.good());
- ofs.close();
- assert( ofs.good());
- ofs << "Hello, World!\n";
- assert(!ofs.good());
+ std::fstream ofs(temp, std::ios::out | std::ios::trunc);
+ ofs << "Hello, World!\n";
+ assert(ofs.good());
+ ofs.close();
+ assert(ofs.good());
+ ofs << "Hello, World!\n";
+ assert(!ofs.good());
- std::remove(temp.c_str());
+ std::remove(temp.c_str());
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx-03/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp b/libcxx/test/libcxx-03/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp
index a03aed123..af14100b7 100644
--- a/libcxx/test/libcxx-03/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp
+++ b/libcxx/test/libcxx-03/input.output/iostream.format/input.streams/traits_mismatch.verify.cpp
@@ -18,8 +18,7 @@
#include <istream>
#include <string>
-struct test_istream
- : public std::basic_istream<char, std::char_traits<wchar_t> > {};
+struct test_istream : public std::basic_istream<char, std::char_traits<wchar_t> > {};
// expected-error-re@*:* {{static assertion failed{{.*}}traits_type::char_type must be the same type as CharT}}
// expected-error@*:* {{only virtual member functions can be marked 'override'}}
diff --git a/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp b/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp
index 9e7bc998e..977add05c 100644
--- a/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp
+++ b/libcxx/test/libcxx-03/input.output/iostream.format/output.streams/traits_mismatch.verify.cpp
@@ -18,8 +18,7 @@
#include <ostream>
#include <string>
-struct test_ostream
- : public std::basic_ostream<char, std::char_traits<wchar_t> > {};
+struct test_ostream : public std::basic_ostream<char, std::char_traits<wchar_t> > {};
// expected-error-re@*:* {{static assertion failed{{.*}}traits_type::char_type must be the same type as CharT}}
// expected-error@*:* {{only virtual member functions can be marked 'override'}}
diff --git a/libcxx/test/libcxx-03/input.output/iostreams.base/ios/iostate.flags/clear.abort.pass.cpp b/libcxx/test/libcxx-03/input.output/iostreams.base/ios/iostate.flags/clear.abort.pass.cpp
index 8f0f5a6d7..ecad8f468 100644
--- a/libcxx/test/libcxx-03/input.output/iostreams.base/ios/iostate.flags/clear.abort.pass.cpp
+++ b/libcxx/test/libcxx-03/input.output/iostreams.base/ios/iostate.flags/clear.abort.pass.cpp
@@ -24,20 +24,17 @@
#include "test_macros.h"
-
-void exit_success(int) {
- std::_Exit(EXIT_SUCCESS);
-}
+void exit_success(int) { std::_Exit(EXIT_SUCCESS); }
struct testbuf : public std::streambuf {};
int main(int, char**) {
- std::signal(SIGABRT, exit_success);
+ std::signal(SIGABRT, exit_success);
- testbuf buf;
- std::ios ios(&buf);
- ios.exceptions(std::ios::badbit);
- ios.clear(std::ios::badbit);
+ testbuf buf;
+ std::ios ios(&buf);
+ ios.exceptions(std::ios::badbit);
+ ios.clear(std::ios::badbit);
- return EXIT_FAILURE;
+ return EXIT_FAILURE;
}
diff --git a/libcxx/test/libcxx-03/iterators/bounded_iter/pointer_traits.pass.cpp b/libcxx/test/libcxx-03/iterators/bounded_iter/pointer_traits.pass.cpp
index 22ad8c670..2658fe269 100644
--- a/libcxx/test/libcxx-03/iterators/bounded_iter/pointer_traits.pass.cpp
+++ b/libcxx/test/libcxx-03/iterators/bounded_iter/pointer_traits.pass.cpp
@@ -24,12 +24,14 @@
template <class Iter>
TEST_CONSTEXPR_CXX14 bool tests() {
- using BoundedIter = std::__bounded_iter<Iter>;
- using PointerTraits = std::pointer_traits<BoundedIter>;
+ using BoundedIter = std::__bounded_iter<Iter>;
+ using PointerTraits = std::pointer_traits<BoundedIter>;
using BasePointerTraits = std::pointer_traits<Iter>;
static_assert(std::is_same<typename PointerTraits::pointer, BoundedIter>::value, "");
- static_assert(std::is_same<typename PointerTraits::element_type, typename BasePointerTraits::element_type>::value, "");
- static_assert(std::is_same<typename PointerTraits::difference_type, typename BasePointerTraits::difference_type>::value, "");
+ static_assert(
+ std::is_same<typename PointerTraits::element_type, typename BasePointerTraits::element_type>::value, "");
+ static_assert(
+ std::is_same<typename PointerTraits::difference_type, typename BasePointerTraits::difference_type>::value, "");
{
int array[] = {0, 1, 2, 3, 4};
diff --git a/libcxx/test/libcxx-03/iterators/bounded_iter/types.compile.pass.cpp b/libcxx/test/libcxx-03/iterators/bounded_iter/types.compile.pass.cpp
index d205c5b03..9f7f88c64 100644
--- a/libcxx/test/libcxx-03/iterators/bounded_iter/types.compile.pass.cpp
+++ b/libcxx/test/libcxx-03/iterators/bounded_iter/types.compile.pass.cpp
@@ -39,7 +39,6 @@ static_assert(std::is_same<BoundedIter1::iterator_category, Iterator::iterator_c
static_assert(std::is_same<BoundedIter1::iterator_concept, Iterator::iterator_concept>::value, "");
#endif
-
using BoundedIter2 = std::__bounded_iter<int*>;
static_assert(std::is_same<BoundedIter2::value_type, int>::value, "");
static_assert(std::is_same<BoundedIter2::difference_type, std::ptrdiff_t>::value, "");
diff --git a/libcxx/test/libcxx-03/iterators/contiguous_iterators.pass.cpp b/libcxx/test/libcxx-03/iterators/contiguous_iterators.pass.cpp
index f00ca4e87..870d90a44 100644
--- a/libcxx/test/libcxx-03/iterators/contiguous_iterators.pass.cpp
+++ b/libcxx/test/libcxx-03/iterators/contiguous_iterators.pass.cpp
@@ -28,238 +28,240 @@
#include "test_iterators.h"
#if TEST_STD_VER >= 17
-#include <string_view>
+# include <string_view>
#endif
#if TEST_STD_VER >= 20
-#include <span>
+# include <span>
#endif
-class T; // incomplete
+class T; // incomplete
+
+class my_input_iterator {
+ struct tag : std::input_iterator_tag {};
+ typedef my_input_iterator Self;
+ int* state_;
-class my_input_iterator
-{
- struct tag : std::input_iterator_tag {};
- typedef my_input_iterator Self;
- int *state_;
public:
- typedef tag iterator_category;
- typedef int value_type;
- typedef int difference_type;
- typedef int* pointer;
- typedef int& reference;
-
- my_input_iterator();
- reference operator*() const;
- pointer operator->() const;
-
- Self& operator++();
- Self operator++(int);
- friend bool operator==(const Self&, const Self&);
- friend bool operator!=(const Self&, const Self&);
+ typedef tag iterator_category;
+ typedef int value_type;
+ typedef int difference_type;
+ typedef int* pointer;
+ typedef int& reference;
+
+ my_input_iterator();
+ reference operator*() const;
+ pointer operator->() const;
+
+ Self& operator++();
+ Self operator++(int);
+ friend bool operator==(const Self&, const Self&);
+ friend bool operator!=(const Self&, const Self&);
};
-class my_random_access_iterator
-{
- struct tag : std::random_access_iterator_tag {};
- typedef my_random_access_iterator Self;
- int *state_;
+class my_random_access_iterator {
+ struct tag : std::random_access_iterator_tag {};
+ typedef my_random_access_iterator Self;
+ int* state_;
+
public:
- typedef tag iterator_category;
- typedef int value_type;
- typedef int difference_type;
- typedef int* pointer;
- typedef int& reference;
-
- my_random_access_iterator();
- reference operator*() const;
- pointer operator->() const;
- reference operator[](difference_type) const;
-
- Self& operator++();
- Self operator++(int);
- Self& operator--();
- Self operator--(int);
- friend Self& operator+=(Self&, difference_type);
- friend Self& operator-=(Self&, difference_type);
- friend Self operator+(Self, difference_type);
- friend Self operator+(difference_type, Self);
- friend Self operator-(Self, difference_type);
- friend difference_type operator-(Self, Self);
- friend bool operator==(const Self&, const Self&);
- friend bool operator!=(const Self&, const Self&);
- friend bool operator<(const Self&, const Self&);
- friend bool operator>(const Self&, const Self&);
- friend bool operator<=(const Self&, const Self&);
- friend bool operator>=(const Self&, const Self&);
+ typedef tag iterator_category;
+ typedef int value_type;
+ typedef int difference_type;
+ typedef int* pointer;
+ typedef int& reference;
+
+ my_random_access_iterator();
+ reference operator*() const;
+ pointer operator->() const;
+ reference operator[](difference_type) const;
+
+ Self& operator++();
+ Self operator++(int);
+ Self& operator--();
+ Self operator--(int);
+ friend Self& operator+=(Self&, difference_type);
+ friend Self& operator-=(Self&, difference_type);
+ friend Self operator+(Self, difference_type);
+ friend Self operator+(difference_type, Self);
+ friend Self operator-(Self, difference_type);
+ friend difference_type operator-(Self, Self);
+ friend bool operator==(const Self&, const Self&);
+ friend bool operator!=(const Self&, const Self&);
+ friend bool operator<(const Self&, const Self&);
+ friend bool operator>(const Self&, const Self&);
+ friend bool operator<=(const Self&, const Self&);
+ friend bool operator>=(const Self&, const Self&);
};
#if TEST_STD_VER >= 20
-class my_contiguous_iterator
-{
- struct tag : std::contiguous_iterator_tag {};
- typedef my_contiguous_iterator Self;
- int *state_;
+class my_contiguous_iterator {
+ struct tag : std::contiguous_iterator_tag {};
+ typedef my_contiguous_iterator Self;
+ int* state_;
+
public:
- typedef tag iterator_category;
- typedef int value_type;
- typedef int difference_type;
- typedef int* pointer;
- typedef int& reference;
- typedef int element_type; // enable to_address via pointer_traits
-
- my_contiguous_iterator();
- reference operator*() const;
- pointer operator->() const;
- reference operator[](difference_type) const;
-
- Self& operator++();
- Self operator++(int);
- Self& operator--();
- Self operator--(int);
- friend Self& operator+=(Self&, difference_type);
- friend Self& operator-=(Self&, difference_type);
- friend Self operator+(Self, difference_type);
- friend Self operator+(difference_type, Self);
- friend Self operator-(Self, difference_type);
- friend difference_type operator-(Self, Self);
- friend bool operator==(const Self&, const Self&);
- friend bool operator!=(const Self&, const Self&);
- friend bool operator<(const Self&, const Self&);
- friend bool operator>(const Self&, const Self&);
- friend bool operator<=(const Self&, const Self&);
- friend bool operator>=(const Self&, const Self&);
+ typedef tag iterator_category;
+ typedef int value_type;
+ typedef int difference_type;
+ typedef int* pointer;
+ typedef int& reference;
+ typedef int element_type; // enable to_address via pointer_traits
+
+ my_contiguous_iterator();
+ reference operator*() const;
+ pointer operator->() const;
+ reference operator[](difference_type) const;
+
+ Self& operator++();
+ Self operator++(int);
+ Self& operator--();
+ Self operator--(int);
+ friend Self& operator+=(Self&, difference_type);
+ friend Self& operator-=(Self&, difference_type);
+ friend Self operator+(Self, difference_type);
+ friend Self operator+(difference_type, Self);
+ friend Self operator-(Self, difference_type);
+ friend difference_type operator-(Self, Self);
+ friend bool operator==(const Self&, const Self&);
+ friend bool operator!=(const Self&, const Self&);
+ friend bool operator<(const Self&, const Self&);
+ friend bool operator>(const Self&, const Self&);
+ friend bool operator<=(const Self&, const Self&);
+ friend bool operator>=(const Self&, const Self&);
};
#endif
struct fake_deque_iterator : std::deque<int>::iterator {
- using element_type = int;
+ using element_type = int;
};
static_assert(std::__has_random_access_iterator_category<fake_deque_iterator>::value, "");
static_assert(!std::__libcpp_is_contiguous_iterator<fake_deque_iterator>::value, "");
#if TEST_STD_VER >= 20
struct fake2_deque_iterator : std::deque<int>::iterator {
- using iterator_concept = std::contiguous_iterator_tag;
- using element_type = int;
+ using iterator_concept = std::contiguous_iterator_tag;
+ using element_type = int;
};
static_assert(std::__has_random_access_iterator_category<fake2_deque_iterator>::value, "");
static_assert(std::__libcpp_is_contiguous_iterator<fake2_deque_iterator>::value, "");
#endif
-int main(int, char**)
-{
-// basic tests
- static_assert(( std::__libcpp_is_contiguous_iterator<char *>::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<const char *>::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<int *>::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<int **>::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<T *>::value), "");
-
- static_assert((!std::__libcpp_is_contiguous_iterator<my_input_iterator>::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<my_random_access_iterator>::value), "");
+int main(int, char**) {
+ // basic tests
+ static_assert((std::__libcpp_is_contiguous_iterator<char*>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<const char*>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<int*>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<int**>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<T*>::value), "");
+
+ static_assert((!std::__libcpp_is_contiguous_iterator<my_input_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<my_random_access_iterator>::value), "");
#if TEST_STD_VER >= 20
- static_assert(( std::__libcpp_is_contiguous_iterator<my_contiguous_iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<my_contiguous_iterator>::value), "");
#endif
- // move_iterator changes value category, which makes it pretty sketchy to use in optimized codepaths
- static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<char *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<const char *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<int *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<T *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<my_random_access_iterator> >::value), "");
+ // move_iterator changes value category, which makes it pretty sketchy to use in optimized codepaths
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<char*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<const char*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<int*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<T*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<my_random_access_iterator> >::value), "");
#if TEST_STD_VER >= 20
- static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<my_contiguous_iterator> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::move_iterator<my_contiguous_iterator> >::value), "");
#endif
- static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<char *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<const char *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<int *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<T *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<my_random_access_iterator> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<char*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<const char*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<int*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<T*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<my_random_access_iterator> >::value), "");
#if TEST_STD_VER >= 20
- static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<my_contiguous_iterator> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::reverse_iterator<my_contiguous_iterator> >::value), "");
#endif
- static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<char *> >::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<const char *> >::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<int *> >::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::__wrap_iter<char*> >::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::__wrap_iter<const char*> >::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::__wrap_iter<int*> >::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<T *> >::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::__wrap_iter<T *> > >::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::__wrap_iter<T*> >::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::__wrap_iter<T*> > >::value), "");
- // Here my_random_access_iterator is standing in for some user's fancy pointer type, written pre-C++20.
- static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<my_random_access_iterator> >::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::__wrap_iter<my_random_access_iterator> > >::value), "");
+ // Here my_random_access_iterator is standing in for some user's fancy pointer type, written pre-C++20.
+ static_assert((std::__libcpp_is_contiguous_iterator<std::__wrap_iter<my_random_access_iterator> >::value), "");
+ static_assert(
+ (std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::__wrap_iter<my_random_access_iterator> > >::value),
+ "");
#if TEST_STD_VER >= 20
- static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<my_contiguous_iterator> >::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::__wrap_iter<my_contiguous_iterator> > >::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::__wrap_iter<my_contiguous_iterator> >::value), "");
+ static_assert(
+ (std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::__wrap_iter<my_contiguous_iterator> > >::value), "");
#endif
-// iterators in the libc++ test suite
- static_assert((!std::__libcpp_is_contiguous_iterator<cpp17_output_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<cpp17_input_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<forward_iterator <char *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<bidirectional_iterator<char *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<random_access_iterator<char *> >::value), "");
+ // iterators in the libc++ test suite
+ static_assert((!std::__libcpp_is_contiguous_iterator<cpp17_output_iterator<char*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<cpp17_input_iterator<char*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<forward_iterator<char*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<bidirectional_iterator<char*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<random_access_iterator<char*> >::value), "");
#if TEST_STD_VER >= 20
- static_assert(( std::__libcpp_is_contiguous_iterator<contiguous_iterator <char *> >::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<contiguous_iterator<char*> >::value), "");
#endif
- static_assert((!std::__libcpp_is_contiguous_iterator<ThrowingIterator <char *> >::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<NonThrowingIterator <char *> >::value), "");
-
-//
-// iterators from libc++'s containers
-//
-
-// vector
- static_assert(( std::__libcpp_is_contiguous_iterator<std::vector<int>::iterator> ::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::vector<int>::const_iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<int>::reverse_iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<int>::const_reverse_iterator> ::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::vector<int>::iterator> >::value), "");
-
-// string
- static_assert(( std::__libcpp_is_contiguous_iterator<std::string::iterator> ::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::string::const_iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::string::reverse_iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::string::const_reverse_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<ThrowingIterator<char*> >::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<NonThrowingIterator<char*> >::value), "");
+
+ //
+ // iterators from libc++'s containers
+ //
+
+ // vector
+ static_assert((std::__libcpp_is_contiguous_iterator<std::vector<int>::iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::vector<int>::const_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<int>::reverse_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<int>::const_reverse_iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::__wrap_iter<std::vector<int>::iterator> >::value), "");
+
+ // string
+ static_assert((std::__libcpp_is_contiguous_iterator<std::string::iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::string::const_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::string::reverse_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::string::const_reverse_iterator>::value), "");
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
- static_assert(( std::__libcpp_is_contiguous_iterator<std::wstring::iterator> ::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::wstring::const_iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::wstring::reverse_iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::wstring::const_reverse_iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::wstring::iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::wstring::const_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::wstring::reverse_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::wstring::const_reverse_iterator>::value), "");
#endif
-// deque is random-access but not contiguous
- static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::const_iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::reverse_iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::const_reverse_iterator> ::value), "");
+ // deque is random-access but not contiguous
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::const_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::reverse_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::deque<int>::const_reverse_iterator>::value), "");
-// vector<bool> is random-access but not contiguous
- static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::const_iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::reverse_iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::const_reverse_iterator> ::value), "");
+ // vector<bool> is random-access but not contiguous
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::const_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::reverse_iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::vector<bool>::const_reverse_iterator>::value), "");
#if TEST_STD_VER >= 11
- static_assert(( std::__libcpp_is_contiguous_iterator<std::initializer_list<int>::iterator> ::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::initializer_list<int>::const_iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::initializer_list<int>::iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::initializer_list<int>::const_iterator>::value), "");
#endif
#if TEST_STD_VER >= 17
- static_assert(( std::__libcpp_is_contiguous_iterator<std::string_view::iterator> ::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::string_view::const_iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::string_view::iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::string_view::const_iterator>::value), "");
#endif
#if TEST_STD_VER >= 20
- static_assert(( std::__libcpp_is_contiguous_iterator<std::span< int>::iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::span< int>::reverse_iterator>::value), "");
- static_assert(( std::__libcpp_is_contiguous_iterator<std::span<const int>::iterator> ::value), "");
- static_assert((!std::__libcpp_is_contiguous_iterator<std::span<const int>::reverse_iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::span< int>::iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::span< int>::reverse_iterator>::value), "");
+ static_assert((std::__libcpp_is_contiguous_iterator<std::span<const int>::iterator>::value), "");
+ static_assert((!std::__libcpp_is_contiguous_iterator<std::span<const int>::reverse_iterator>::value), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx-03/iterators/unwrap_iter.pass.cpp b/libcxx/test/libcxx-03/iterators/unwrap_iter.pass.cpp
index 8ef2be2b0..2a0bad78e 100644
--- a/libcxx/test/libcxx-03/iterators/unwrap_iter.pass.cpp
+++ b/libcxx/test/libcxx-03/iterators/unwrap_iter.pass.cpp
@@ -30,16 +30,23 @@ static_assert(std::is_same<UnwrapT<std::__wrap_iter<int*> >, int*>::value, "");
static_assert(std::is_same<UnwrapT<rev_iter<int*> >, std::reverse_iterator<int*> >::value, "");
static_assert(std::is_same<UnwrapT<rev_rev_iter<int*> >, int*>::value, "");
static_assert(std::is_same<UnwrapT<rev_rev_iter<std::__wrap_iter<int*> > >, int*>::value, "");
-static_assert(std::is_same<UnwrapT<rev_rev_iter<rev_iter<std::__wrap_iter<int*> > > >, rev_iter<std::__wrap_iter<int*> > >::value, "");
+static_assert(
+ std::is_same<UnwrapT<rev_rev_iter<rev_iter<std::__wrap_iter<int*> > > >, rev_iter<std::__wrap_iter<int*> > >::value,
+ "");
static_assert(std::is_same<UnwrapT<random_access_iterator<int*> >, random_access_iterator<int*> >::value, "");
-static_assert(std::is_same<UnwrapT<rev_iter<random_access_iterator<int*> > >, rev_iter<random_access_iterator<int*> > >::value, "");
-static_assert(std::is_same<UnwrapT<rev_rev_iter<random_access_iterator<int*> > >, random_access_iterator<int*> >::value, "");
-static_assert(std::is_same<UnwrapT<rev_rev_iter<rev_iter<random_access_iterator<int*> > > >, rev_iter<random_access_iterator<int*> > >::value, "");
+static_assert(
+ std::is_same<UnwrapT<rev_iter<random_access_iterator<int*> > >, rev_iter<random_access_iterator<int*> > >::value,
+ "");
+static_assert(std::is_same<UnwrapT<rev_rev_iter<random_access_iterator<int*> > >, random_access_iterator<int*> >::value,
+ "");
+static_assert(std::is_same<UnwrapT<rev_rev_iter<rev_iter<random_access_iterator<int*> > > >,
+ rev_iter<random_access_iterator<int*> > >::value,
+ "");
TEST_CONSTEXPR_CXX20 bool test() {
std::string str = "Banane";
- using Iter = std::string::iterator;
+ using Iter = std::string::iterator;
assert(std::__unwrap_iter(str.begin()) == str.data());
assert(std::__unwrap_iter(str.end()) == str.data() + str.size());
diff --git a/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.apple.compile.pass.cpp b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.apple.compile.pass.cpp
index 6c6b1d44c..a3c0b4dad 100644
--- a/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.apple.compile.pass.cpp
+++ b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.apple.compile.pass.cpp
@@ -14,17 +14,17 @@
#include <typeinfo>
#if !defined(_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION)
-# error "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION should be defined on Apple platforms"
+# error "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION should be defined on Apple platforms"
#endif
#if defined(__x86_64__) || defined(__ARM_ARCH_7M__)
-# if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION != 1
-# error "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION should be 1 (assume RTTI is merged) on Apple platforms"
-# endif
+# if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION != 1
+# error "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION should be 1 (assume RTTI is merged) on Apple platforms"
+# endif
#elif defined(__aarch64__)
-# if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION != 3
-# error "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION should be 3 (use the special ARM RTTI) on Apple platforms"
-# endif
+# if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION != 3
+# error "_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION should be 3 (use the special ARM RTTI) on Apple platforms"
+# endif
#else
-# error "This test should be updated to pin down the RTTI behavior on this ABI."
+# error "This test should be updated to pin down the RTTI behavior on this ABI."
#endif
diff --git a/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
index da82ea1d2..c0eeb69ee 100644
--- a/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
+++ b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.merged.sh.cpp
@@ -27,22 +27,30 @@ void register1();
void register2();
#if defined(TU1)
- namespace { struct A { bool x; }; }
- void register1() { registry.push_back(std::type_index(typeid(A))); }
+namespace {
+struct A {
+ bool x;
+};
+} // namespace
+void register1() { registry.push_back(std::type_index(typeid(A))); }
#elif defined(TU2)
- namespace { struct A { int x, y; }; }
- void register2() { registry.push_back(std::type_index(typeid(A))); }
+namespace {
+struct A {
+ int x, y;
+};
+} // namespace
+void register2() { registry.push_back(std::type_index(typeid(A))); }
#elif defined(MAIN)
- std::vector<std::type_index> registry;
+std::vector<std::type_index> registry;
- int main(int, char**) {
- register1();
- register2();
+int main(int, char**) {
+ register1();
+ register2();
- assert(registry.size() == 2);
- assert(registry[0] != registry[1]);
- return 0;
- }
+ assert(registry.size() == 2);
+ assert(registry[0] != registry[1]);
+ return 0;
+}
#else
-# error
+# error
#endif
diff --git a/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
index 9b94fcbc1..eecb4a047 100644
--- a/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
+++ b/libcxx/test/libcxx-03/language.support/support.rtti/type.info/type_info.comparison.unmerged.sh.cpp
@@ -24,22 +24,30 @@ void register1();
void register2();
#if defined(TU1)
- namespace { struct A { bool x; }; }
- void register1() { registry.push_back(std::type_index(typeid(A))); }
+namespace {
+struct A {
+ bool x;
+};
+} // namespace
+void register1() { registry.push_back(std::type_index(typeid(A))); }
#elif defined(TU2)
- namespace { struct A { int x, y; }; }
- void register2() { registry.push_back(std::type_index(typeid(A))); }
+namespace {
+struct A {
+ int x, y;
+};
+} // namespace
+void register2() { registry.push_back(std::type_index(typeid(A))); }
#elif defined(MAIN)
- std::vector<std::type_index> registry;
+std::vector<std::type_index> registry;
- int main(int, char**) {
- register1();
- register2();
+int main(int, char**) {
+ register1();
+ register2();
- assert(registry.size() == 2);
- assert(registry[0] == registry[1]);
- return 0;
- }
+ assert(registry.size() == 2);
+ assert(registry[0] == registry[1]);
+ return 0;
+}
#else
-# error
+# error
#endif
diff --git a/libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp b/libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp
index 8dd7a8ac8..c476f0f06 100644
--- a/libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp
+++ b/libcxx/test/libcxx-03/libcpp_freestanding.sh.cpp
@@ -15,6 +15,6 @@
#include <__config>
#if defined(FREESTANDING) != defined(_LIBCPP_FREESTANDING)
-#error _LIBCPP_FREESTANDING should be defined in freestanding mode and not \
+# error _LIBCPP_FREESTANDING should be defined in freestanding mode and not \
defined in non-freestanding mode
#endif
diff --git a/libcxx/test/libcxx-03/localization/locale.categories/__scan_keyword.pass.cpp b/libcxx/test/libcxx-03/localization/locale.categories/__scan_keyword.pass.cpp
index 1ecf378de..12f92b731 100644
--- a/libcxx/test/libcxx-03/localization/locale.categories/__scan_keyword.pass.cpp
+++ b/libcxx/test/libcxx-03/localization/locale.categories/__scan_keyword.pass.cpp
@@ -40,82 +40,75 @@
#include "test_macros.h"
-int main(int, char**)
-{
- const std::ctype<char>& ct = std::use_facet<std::ctype<char> >(std::locale::classic());
- std::ios_base::iostate err = std::ios_base::goodbit;
- {
- const char input[] = "a";
- const char* in = input;
- std::string keys[] = {"a", "abb"};
- err = std::ios_base::goodbit;
- std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
- keys, keys+sizeof(keys)/sizeof(keys[0]),
- ct, err);
- assert(k - keys == 0);
- assert(in == input+1);
- assert(err == std::ios_base::eofbit);
- }
- {
- const char input[] = "abc";
- const char* in = input;
- std::string keys[] = {"a", "abb"};
- err = std::ios_base::goodbit;
- std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
- keys, keys+sizeof(keys)/sizeof(keys[0]),
- ct, err);
- assert(k - keys == 2);
- assert(in == input+2);
- assert(err == std::ios_base::failbit);
- }
- {
- const char input[] = "abb";
- const char* in = input;
- std::string keys[] = {"a", "abb"};
- err = std::ios_base::goodbit;
- std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
- keys, keys+sizeof(keys)/sizeof(keys[0]),
- ct, err);
- assert(k - keys == 1);
- assert(in == input+3);
- assert(err == std::ios_base::eofbit);
- }
- {
- const char input[] = "Tue ";
- const char* in = input;
- std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
- err = std::ios_base::goodbit;
- std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
- keys, keys+sizeof(keys)/sizeof(keys[0]),
- ct, err);
- assert(k - keys == 2);
- assert(in == input+3);
- assert(err == std::ios_base::goodbit);
- }
- {
- const char input[] = "tue ";
- const char* in = input;
- std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
- err = std::ios_base::goodbit;
- std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
- keys, keys+sizeof(keys)/sizeof(keys[0]),
- ct, err);
- assert(k - keys == 4);
- assert(in == input+0);
- assert(err == std::ios_base::failbit);
- }
- {
- const char input[] = "tue ";
- const char* in = input;
- std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
- err = std::ios_base::goodbit;
- std::string* k = std::__scan_keyword(in, input+sizeof(input)-1,
- keys, keys+sizeof(keys)/sizeof(keys[0]),
- ct, err, false);
- assert(k - keys == 2);
- assert(in == input+3);
- assert(err == std::ios_base::goodbit);
- }
+int main(int, char**) {
+ const std::ctype<char>& ct = std::use_facet<std::ctype<char> >(std::locale::classic());
+ std::ios_base::iostate err = std::ios_base::goodbit;
+ {
+ const char input[] = "a";
+ const char* in = input;
+ std::string keys[] = {"a", "abb"};
+ err = std::ios_base::goodbit;
+ std::string* k =
+ std::__scan_keyword(in, input + sizeof(input) - 1, keys, keys + sizeof(keys) / sizeof(keys[0]), ct, err);
+ assert(k - keys == 0);
+ assert(in == input + 1);
+ assert(err == std::ios_base::eofbit);
+ }
+ {
+ const char input[] = "abc";
+ const char* in = input;
+ std::string keys[] = {"a", "abb"};
+ err = std::ios_base::goodbit;
+ std::string* k =
+ std::__scan_keyword(in, input + sizeof(input) - 1, keys, keys + sizeof(keys) / sizeof(keys[0]), ct, err);
+ assert(k - keys == 2);
+ assert(in == input + 2);
+ assert(err == std::ios_base::failbit);
+ }
+ {
+ const char input[] = "abb";
+ const char* in = input;
+ std::string keys[] = {"a", "abb"};
+ err = std::ios_base::goodbit;
+ std::string* k =
+ std::__scan_keyword(in, input + sizeof(input) - 1, keys, keys + sizeof(keys) / sizeof(keys[0]), ct, err);
+ assert(k - keys == 1);
+ assert(in == input + 3);
+ assert(err == std::ios_base::eofbit);
+ }
+ {
+ const char input[] = "Tue ";
+ const char* in = input;
+ std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
+ err = std::ios_base::goodbit;
+ std::string* k =
+ std::__scan_keyword(in, input + sizeof(input) - 1, keys, keys + sizeof(keys) / sizeof(keys[0]), ct, err);
+ assert(k - keys == 2);
+ assert(in == input + 3);
+ assert(err == std::ios_base::goodbit);
+ }
+ {
+ const char input[] = "tue ";
+ const char* in = input;
+ std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
+ err = std::ios_base::goodbit;
+ std::string* k =
+ std::__scan_keyword(in, input + sizeof(input) - 1, keys, keys + sizeof(keys) / sizeof(keys[0]), ct, err);
+ assert(k - keys == 4);
+ assert(in == input + 0);
+ assert(err == std::ios_base::failbit);
+ }
+ {
+ const char input[] = "tue ";
+ const char* in = input;
+ std::string keys[] = {"Mon", "Monday", "Tue", "Tuesday"};
+ err = std::ios_base::goodbit;
+ std::string* k =
+ std::__scan_keyword(in, input + sizeof(input) - 1, keys, keys + sizeof(keys) / sizeof(keys[0]), ct, err, false);
+ assert(k - keys == 2);
+ assert(in == input + 3);
+ assert(err == std::ios_base::goodbit);
+ }
return 0;
}
diff --git a/libcxx/test/libcxx-03/localization/locales/locale.abort.pass.cpp b/libcxx/test/libcxx-03/localization/locales/locale.abort.pass.cpp
index 9a47eb8f1..7d42d0c76 100644
--- a/libcxx/test/libcxx-03/localization/locales/locale.abort.pass.cpp
+++ b/libcxx/test/libcxx-03/localization/locales/locale.abort.pass.cpp
@@ -23,14 +23,11 @@
#include "test_macros.h"
-
-void exit_success(int) {
- std::_Exit(EXIT_SUCCESS);
-}
+void exit_success(int) { std::_Exit(EXIT_SUCCESS); }
int main(int, char**) {
- std::signal(SIGABRT, exit_success);
- std::locale loc(NULL);
- (void)loc;
- return EXIT_FAILURE;
+ std::signal(SIGABRT, exit_success);
+ std::locale loc(NULL);
+ (void)loc;
+ return EXIT_FAILURE;
}
diff --git a/libcxx/test/libcxx-03/localization/locales/locale.category.abort.pass.cpp b/libcxx/test/libcxx-03/localization/locales/locale.category.abort.pass.cpp
index 9b321e6b1..a543985a0 100644
--- a/libcxx/test/libcxx-03/localization/locales/locale.category.abort.pass.cpp
+++ b/libcxx/test/libcxx-03/localization/locales/locale.category.abort.pass.cpp
@@ -23,14 +23,11 @@
#include "test_macros.h"
-
-void exit_success(int) {
- std::_Exit(EXIT_SUCCESS);
-}
+void exit_success(int) { std::_Exit(EXIT_SUCCESS); }
int main(int, char**) {
- std::signal(SIGABRT, exit_success);
- std::locale loc(std::locale(), NULL, std::locale::ctype);
- (void)loc;
- return EXIT_FAILURE;
+ std::signal(SIGABRT, exit_success);
+ std::locale loc(std::locale(), NULL, std::locale::ctype);
+ (void)loc;
+ return EXIT_FAILURE;
}
diff --git a/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp b/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp
index 072c85a11..040963c18 100644
--- a/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp
+++ b/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.facet/facet.pass.cpp
@@ -24,33 +24,28 @@
#include "test_macros.h"
-struct my_facet
- : public std::locale::facet
-{
- static int count;
- my_facet(unsigned refs = 0)
- : std::locale::facet(refs)
- {++count;}
-
- ~my_facet() {--count;}
+struct my_facet : public std::locale::facet {
+ static int count;
+ my_facet(unsigned refs = 0) : std::locale::facet(refs) { ++count; }
+
+ ~my_facet() { --count; }
};
int my_facet::count = 0;
-int main(int, char**)
-{
- my_facet* f = new my_facet;
- f->__add_shared();
- assert(my_facet::count == 1);
- f->__release_shared();
- assert(my_facet::count == 0);
- f = new my_facet(1);
- f->__add_shared();
- assert(my_facet::count == 1);
- f->__release_shared();
- assert(my_facet::count == 1);
- f->__release_shared();
- assert(my_facet::count == 0);
+int main(int, char**) {
+ my_facet* f = new my_facet;
+ f->__add_shared();
+ assert(my_facet::count == 1);
+ f->__release_shared();
+ assert(my_facet::count == 0);
+ f = new my_facet(1);
+ f->__add_shared();
+ assert(my_facet::count == 1);
+ f->__release_shared();
+ assert(my_facet::count == 1);
+ f->__release_shared();
+ assert(my_facet::count == 0);
return 0;
}
diff --git a/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.id/id.pass.cpp b/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.id/id.pass.cpp
index 5e0113474..2a98da89e 100644
--- a/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.id/id.pass.cpp
+++ b/libcxx/test/libcxx-03/localization/locales/locale/locale.types/locale.id/id.pass.cpp
@@ -27,27 +27,26 @@ std::locale::id id0;
std::locale::id id2;
std::locale::id id1;
-int main(int, char**)
-{
- long id = id0.__get();
- assert(id0.__get() == id+0);
- assert(id0.__get() == id+0);
- assert(id0.__get() == id+0);
- assert(id1.__get() == id+1);
- assert(id1.__get() == id+1);
- assert(id1.__get() == id+1);
- assert(id2.__get() == id+2);
- assert(id2.__get() == id+2);
- assert(id2.__get() == id+2);
- assert(id0.__get() == id+0);
- assert(id0.__get() == id+0);
- assert(id0.__get() == id+0);
- assert(id1.__get() == id+1);
- assert(id1.__get() == id+1);
- assert(id1.__get() == id+1);
- assert(id2.__get() == id+2);
- assert(id2.__get() == id+2);
- assert(id2.__get() == id+2);
+int main(int, char**) {
+ long id = id0.__get();
+ assert(id0.__get() == id + 0);
+ assert(id0.__get() == id + 0);
+ assert(id0.__get() == id + 0);
+ assert(id1.__get() == id + 1);
+ assert(id1.__get() == id + 1);
+ assert(id1.__get() == id + 1);
+ assert(id2.__get() == id + 2);
+ assert(id2.__get() == id + 2);
+ assert(id2.__get() == id + 2);
+ assert(id0.__get() == id + 0);
+ assert(id0.__get() == id + 0);
+ assert(id0.__get() == id + 0);
+ assert(id1.__get() == id + 1);
+ assert(id1.__get() == id + 1);
+ assert(id1.__get() == id + 1);
+ assert(id2.__get() == id + 2);
+ assert(id2.__get() == id + 2);
+ assert(id2.__get() == id + 2);
return 0;
}
diff --git a/libcxx/test/libcxx-03/localization/locales/use_facet.abort.pass.cpp b/libcxx/test/libcxx-03/localization/locales/use_facet.abort.pass.cpp
index 9b4755a81..bfca71f10 100644
--- a/libcxx/test/libcxx-03/localization/locales/use_facet.abort.pass.cpp
+++ b/libcxx/test/libcxx-03/localization/locales/use_facet.abort.pass.cpp
@@ -21,19 +21,16 @@
#include "test_macros.h"
-
struct my_facet : public std::locale::facet {
- static std::locale::id id;
+ static std::locale::id id;
};
std::locale::id my_facet::id;
-void exit_success(int) {
- std::_Exit(EXIT_SUCCESS);
-}
+void exit_success(int) { std::_Exit(EXIT_SUCCESS); }
int main(int, char**) {
- std::signal(SIGABRT, exit_success);
- std::use_facet<my_facet>(std::locale());
- return EXIT_FAILURE;
+ std::signal(SIGABRT, exit_success);
+ std::use_facet<my_facet>(std::locale());
+ return EXIT_FAILURE;
}
diff --git a/libcxx/test/libcxx-03/memory/allocation_guard.pass.cpp b/libcxx/test/libcxx-03/memory/allocation_guard.pass.cpp
index 20c05b381..dc6a3213c 100644
--- a/libcxx/test/libcxx-03/memory/allocation_guard.pass.cpp
+++ b/libcxx/test/libcxx-03/memory/allocation_guard.pass.cpp
@@ -30,12 +30,12 @@ using A = test_allocator<int>;
// assignment).
template <class T>
struct AssignableAllocator {
- using size_type = unsigned;
+ using size_type = unsigned;
using difference_type = int;
- using value_type = T;
- using pointer = value_type*;
- using const_pointer = const value_type*;
- using reference = typename std::add_lvalue_reference<value_type>::type;
+ using value_type = T;
+ using pointer = value_type*;
+ using const_pointer = const value_type*;
+ using reference = typename std::add_lvalue_reference<value_type>::type;
using const_reference = typename std::add_lvalue_reference<const value_type>::type;
template <class U>
@@ -45,12 +45,9 @@ struct AssignableAllocator {
test_allocator_statistics* stats_ = nullptr;
- explicit AssignableAllocator(test_allocator_statistics& stats) : stats_(&stats) {
- ++stats_->count;
- }
+ explicit AssignableAllocator(test_allocator_statistics& stats) : stats_(&stats) { ++stats_->count; }
- TEST_CONSTEXPR_CXX14 AssignableAllocator(const AssignableAllocator& rhs) TEST_NOEXCEPT
- : stats_(rhs.stats_) {
+ TEST_CONSTEXPR_CXX14 AssignableAllocator(const AssignableAllocator& rhs) TEST_NOEXCEPT : stats_(rhs.stats_) {
if (stats_ != nullptr) {
++stats_->count;
++stats_->copied;
diff --git a/libcxx/test/libcxx-03/memory/allocator_void.trivial.compile.pass.cpp b/libcxx/test/libcxx-03/memory/allocator_void.trivial.compile.pass.cpp
index b7dfc190e..2b1fc6525 100644
--- a/libcxx/test/libcxx-03/memory/allocator_void.trivial.compile.pass.cpp
+++ b/libcxx/test/libcxx-03/memory/allocator_void.trivial.compile.pass.cpp
@@ -17,7 +17,7 @@
#include <type_traits>
typedef std::allocator<void> A1;
-struct A2 : std::allocator<void> { };
+struct A2 : std::allocator<void> {};
static_assert(std::is_trivially_default_constructible<A1>::value, "");
static_assert(std::is_trivially_copyable<A1>::value, "");
diff --git a/libcxx/test/libcxx-03/memory/allocator_volatile.verify.cpp b/libcxx/test/libcxx-03/memory/allocator_volatile.verify.cpp
index 53fdc08e7..3a9ccb2ce 100644
--- a/libcxx/test/libcxx-03/memory/allocator_volatile.verify.cpp
+++ b/libcxx/test/libcxx-03/memory/allocator_volatile.verify.cpp
@@ -10,5 +10,5 @@
#include <memory>
-std::allocator<const int> A1; // expected-error@*:* {{std::allocator does not support const types}}
+std::allocator<const int> A1; // expected-error@*:* {{std::allocator does not support const types}}
std::allocator<volatile int> A2; // expected-error@*:* {{std::allocator does not support volatile types}}
diff --git a/libcxx/test/libcxx-03/memory/is_allocator.pass.cpp b/libcxx/test/libcxx-03/memory/is_allocator.pass.cpp
index cf11d077b..7c5f9d129 100644
--- a/libcxx/test/libcxx-03/memory/is_allocator.pass.cpp
+++ b/libcxx/test/libcxx-03/memory/is_allocator.pass.cpp
@@ -23,21 +23,18 @@
#include "test_allocator.h"
template <typename T>
-void test_allocators()
-{
- static_assert(!std::__is_allocator<T>::value, "" );
- static_assert( std::__is_allocator<std::allocator<T>>::value, "" );
- static_assert( std::__is_allocator<test_allocator<T>>::value, "" );
- static_assert( std::__is_allocator<min_allocator<T>>::value, "" );
+void test_allocators() {
+ static_assert(!std::__is_allocator<T>::value, "");
+ static_assert(std::__is_allocator<std::allocator<T>>::value, "");
+ static_assert(std::__is_allocator<test_allocator<T>>::value, "");
+ static_assert(std::__is_allocator<min_allocator<T>>::value, "");
}
+int main(int, char**) {
+ // test_allocators<void>();
+ test_allocators<char>();
+ test_allocators<int>();
+ test_allocators<std::string>();
-int main(int, char**)
-{
- // test_allocators<void>();
- test_allocators<char>();
- test_allocators<int>();
- test_allocators<std::string>();
-
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx-03/memory/swap_allocator.pass.cpp b/libcxx/test/libcxx-03/memory/swap_allocator.pass.cpp
index f70f8134d..c905b895f 100644
--- a/libcxx/test/libcxx-03/memory/swap_allocator.pass.cpp
+++ b/libcxx/test/libcxx-03/memory/swap_allocator.pass.cpp
@@ -23,17 +23,14 @@
template <bool Propagate, bool Noexcept>
struct Alloc {
- int i = 0;
+ int i = 0;
Alloc() = default;
Alloc(int set_i) : i(set_i) {}
- using value_type = int;
+ using value_type = int;
using propagate_on_container_swap = std::integral_constant<bool, Propagate>;
- friend void swap(Alloc& a1, Alloc& a2) TEST_NOEXCEPT_COND(Noexcept) {
- std::swap(a1.i, a2.i);
- }
-
+ friend void swap(Alloc& a1, Alloc& a2) TEST_NOEXCEPT_COND(Noexcept) { std::swap(a1.i, a2.i); }
};
using PropagatingAlloc = Alloc</*Propagate=*/true, /*Noexcept=*/true>;
@@ -66,18 +63,18 @@ int main(int, char**) {
static_assert(noexcept(std::__swap_allocator(noexcept_alloc, noexcept_alloc)), "");
}
-#if TEST_STD_VER > 11
+# if TEST_STD_VER > 11
{ // From C++14, `__swap_allocator` is unconditionally noexcept.
ThrowingSwapAlloc throwing_alloc;
static_assert(noexcept(std::__swap_allocator(throwing_alloc, throwing_alloc)), "");
}
-#else
+# else
{ // Until C++14, `__swap_allocator` is only noexcept if the underlying `swap` function is `noexcept`.
ThrowingSwapAlloc throwing_alloc;
static_assert(!noexcept(std::__swap_allocator(throwing_alloc, throwing_alloc)), "");
}
-#endif // TEST_STD_VER > 11
-#endif // TEST_STD_VER >= 11
+# endif // TEST_STD_VER > 11
+#endif // TEST_STD_VER >= 11
return 0;
}
diff --git a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_arg.pass.cpp b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_arg.pass.cpp
index 8a7367bf2..2ef4fdd6e 100644
--- a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_arg.pass.cpp
+++ b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_arg.pass.cpp
@@ -31,9 +31,7 @@ __attribute__((noinline)) bool get_val(std::unique_ptr<Node> /*unused*/) {
return true;
}
-__attribute__((noinline)) void expect_1(int* shared, bool /*unused*/) {
- assert(*shared == 1);
-}
+__attribute__((noinline)) void expect_1(int* shared, bool /*unused*/) { assert(*shared == 1); }
int main(int, char**) {
int shared = 0;
diff --git a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp
index 8752ba5a0..cc9a95561 100644
--- a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp
+++ b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp
@@ -26,9 +26,8 @@ struct Base {
int* cur_idx;
const char id;
- explicit Base(char* buf, int* idx, char ch)
- : shared_buff(buf), cur_idx(idx), id(ch) {}
- Base(const Base& other) = default;
+ explicit Base(char* buf, int* idx, char ch) : shared_buff(buf), cur_idx(idx), id(ch) {}
+ Base(const Base& other) = default;
Base& operator=(const Base&) = delete;
~Base() { shared_buff[(*cur_idx)++] = id; }
};
@@ -45,17 +44,13 @@ struct C : Base {
explicit C(char* buf, int* idx) : Base(buf, idx, 'C') {}
};
-__attribute__((noinline)) void func(A /*unused*/, std::unique_ptr<B> /*unused*/,
- C /*unused*/) {
- call_something();
-}
+__attribute__((noinline)) void func(A /*unused*/, std::unique_ptr<B> /*unused*/, C /*unused*/) { call_something(); }
int main(int, char**) {
char shared_buf[3] = {'0', '0', '0'};
- int cur_idx = 0;
+ int cur_idx = 0;
- func(A(shared_buf, &cur_idx), std::unique_ptr<B>(new B(shared_buf, &cur_idx)),
- C(shared_buf, &cur_idx));
+ func(A(shared_buf, &cur_idx), std::unique_ptr<B>(new B(shared_buf, &cur_idx)), C(shared_buf, &cur_idx));
#if defined(TEST_ABI_MICROSOFT)
// On Microsoft ABI, the dtor order is always A,B,C (because callee-destroyed)
diff --git a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_ret.pass.cpp b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_ret.pass.cpp
index 65e9069e0..6bb097f74 100644
--- a/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_ret.pass.cpp
+++ b/libcxx/test/libcxx-03/memory/trivial_abi/unique_ptr_ret.pass.cpp
@@ -21,7 +21,7 @@ __attribute__((noinline)) void call_something() { asm volatile(""); }
struct Node {
explicit Node() {}
- Node(const Node&) = default;
+ Node(const Node&) = default;
Node& operator=(const Node&) = default;
~Node() {}
};
@@ -39,7 +39,7 @@ __attribute__((noinline)) std::unique_ptr<Node> make_val(void** local_addr) {
int main(int, char**) {
void* local_addr = nullptr;
- auto ret = make_val(&local_addr);
+ auto ret = make_val(&local_addr);
assert(local_addr != nullptr);
// Without trivial_abi, &ret == local_addr because the return value
diff --git a/libcxx/test/libcxx-03/memory/trivial_abi/weak_ptr_ret.pass.cpp b/libcxx/test/libcxx-03/memory/trivial_abi/weak_ptr_ret.pass.cpp
index 0b1a434ee..12ace6539 100644
--- a/libcxx/test/libcxx-03/memory/trivial_abi/weak_ptr_ret.pass.cpp
+++ b/libcxx/test/libcxx-03/memory/trivial_abi/weak_ptr_ret.pass.cpp
@@ -21,13 +21,12 @@ __attribute__((noinline)) void call_something() { asm volatile(""); }
struct Node {
explicit Node() {}
- Node(const Node&) = default;
+ Node(const Node&) = default;
Node& operator=(const Node&) = default;
~Node() {}
};
-__attribute__((noinline)) std::weak_ptr<Node>
-make_val(std::shared_ptr<Node>& sptr, void** local_addr) {
+__attribute__((noinline)) std::weak_ptr<Node> make_val(std::shared_ptr<Node>& sptr, void** local_addr) {
call_something();
std::weak_ptr<Node> ret;
@@ -40,8 +39,8 @@ make_val(std::shared_ptr<Node>& sptr, void** local_addr) {
}
int main(int, char**) {
- void* local_addr = nullptr;
- auto sptr = std::make_shared<Node>();
+ void* local_addr = nullptr;
+ auto sptr = std::make_shared<Node>();
std::weak_ptr<Node> ret = make_val(sptr, &local_addr);
assert(local_addr != nullptr);
diff --git a/libcxx/test/libcxx-03/numerics/clamp_to_integral.pass.cpp b/libcxx/test/libcxx-03/numerics/clamp_to_integral.pass.cpp
index 68d55afa1..192e61f25 100644
--- a/libcxx/test/libcxx-03/numerics/clamp_to_integral.pass.cpp
+++ b/libcxx/test/libcxx-03/numerics/clamp_to_integral.pass.cpp
@@ -23,7 +23,7 @@ template <class IntT>
void test() {
typedef std::numeric_limits<IntT> Lim;
const bool MaxIsRepresentable = sizeof(IntT) < 8;
- const bool IsSigned = std::is_signed<IntT>::value;
+ const bool IsSigned = std::is_signed<IntT>::value;
struct TestCase {
double Input;
IntT Expect;
@@ -31,8 +31,7 @@ void test() {
} TestCases[] = {
{0, 0, true},
{1, 1, true},
- {IsSigned ? static_cast<IntT>(-1) : 0,
- IsSigned ? static_cast<IntT>(-1) : 0, true},
+ {IsSigned ? static_cast<IntT>(-1) : 0, IsSigned ? static_cast<IntT>(-1) : 0, true},
{Lim::lowest(), Lim::lowest(), true},
{static_cast<double>(Lim::max()), Lim::max(), MaxIsRepresentable},
{static_cast<double>(Lim::max()) + 1, Lim::max(), false},
@@ -63,11 +62,10 @@ void test_float() {
} TestCases[] = {
{0, 0, true},
{1, 1, true},
- {IsSigned ? static_cast<IntT>(-1) : 0,
- IsSigned ? static_cast<IntT>(-1) : 0, true},
+ {IsSigned ? static_cast<IntT>(-1) : 0, IsSigned ? static_cast<IntT>(-1) : 0, true},
{Lim::lowest(), Lim::lowest(), true},
- {static_cast<float>(Lim::max()), Lim::max(), MaxIsRepresentable },
- {nextafter(static_cast<float>(Lim::max()), INFINITY), Lim::max(), false},
+ {static_cast<float>(Lim::max()), Lim::max(), MaxIsRepresentable},
+ {nextafter(static_cast<float>(Lim::max()), INFINITY), Lim::max(), false},
};
for (TestCase TC : TestCases) {
auto res = std::__clamp_to_integral<IntT>(TC.Input);
diff --git a/libcxx/test/libcxx-03/numerics/complex.number/__sqr.pass.cpp b/libcxx/test/libcxx-03/numerics/complex.number/__sqr.pass.cpp
index 97f4a2419..bc2cb9404 100644
--- a/libcxx/test/libcxx-03/numerics/complex.number/__sqr.pass.cpp
+++ b/libcxx/test/libcxx-03/numerics/complex.number/__sqr.pass.cpp
@@ -18,67 +18,62 @@
#include "test_macros.h"
template <class T>
-void
-test()
-{
- const T tolerance = std::is_same<T, float>::value ? 1.e-6 : 1.e-14;
+void test() {
+ const T tolerance = std::is_same<T, float>::value ? 1.e-6 : 1.e-14;
- typedef std::complex<T> cplx;
- struct test_case
- {
- cplx value;
- cplx expected;
- };
+ typedef std::complex<T> cplx;
+ struct test_case {
+ cplx value;
+ cplx expected;
+ };
- const test_case cases[] = {
- {cplx( 0, 0), cplx( 0, 0)},
- {cplx( 1, 0), cplx( 1, 0)},
- {cplx( 2, 0), cplx( 4, 0)},
- {cplx(-1, 0), cplx( 1, 0)},
- {cplx( 0, 1), cplx(-1, 0)},
- {cplx( 0, 2), cplx(-4, 0)},
- {cplx( 0, -1), cplx(-1, 0)},
- {cplx( 1, 1), cplx( 0, 2)},
- {cplx( 1, -1), cplx( 0, -2)},
- {cplx(-1, -1), cplx( 0, 2)},
- {cplx(0.5, 0), cplx(0.25, 0)},
- };
+ const test_case cases[] = {
+ {cplx(0, 0), cplx(0, 0)},
+ {cplx(1, 0), cplx(1, 0)},
+ {cplx(2, 0), cplx(4, 0)},
+ {cplx(-1, 0), cplx(1, 0)},
+ {cplx(0, 1), cplx(-1, 0)},
+ {cplx(0, 2), cplx(-4, 0)},
+ {cplx(0, -1), cplx(-1, 0)},
+ {cplx(1, 1), cplx(0, 2)},
+ {cplx(1, -1), cplx(0, -2)},
+ {cplx(-1, -1), cplx(0, 2)},
+ {cplx(0.5, 0), cplx(0.25, 0)},
+ };
- const unsigned num_cases = sizeof(cases) / sizeof(test_case);
- for (unsigned i = 0; i < num_cases; ++i)
- {
- const test_case& test = cases[i];
- const std::complex<T> actual = std::__sqr(test.value);
- assert(std::abs(actual.real() - test.expected.real()) < tolerance);
- assert(std::abs(actual.imag() - test.expected.imag()) < tolerance);
- }
+ const unsigned num_cases = sizeof(cases) / sizeof(test_case);
+ for (unsigned i = 0; i < num_cases; ++i) {
+ const test_case& test = cases[i];
+ const std::complex<T> actual = std::__sqr(test.value);
+ assert(std::abs(actual.real() - test.expected.real()) < tolerance);
+ assert(std::abs(actual.imag() - test.expected.imag()) < tolerance);
+ }
- const cplx nan1 = std::__sqr(cplx(NAN, 0));
- assert(std::isnan(nan1.real()));
- assert(std::isnan(nan1.imag()));
+ const cplx nan1 = std::__sqr(cplx(NAN, 0));
+ assert(std::isnan(nan1.real()));
+ assert(std::isnan(nan1.imag()));
- const cplx nan2 = std::__sqr(cplx(0, NAN));
- assert(std::isnan(nan2.real()));
- assert(std::isnan(nan2.imag()));
+ const cplx nan2 = std::__sqr(cplx(0, NAN));
+ assert(std::isnan(nan2.real()));
+ assert(std::isnan(nan2.imag()));
- const cplx nan3 = std::__sqr(cplx(NAN, NAN));
- assert(std::isnan(nan3.real()));
- assert(std::isnan(nan3.imag()));
+ const cplx nan3 = std::__sqr(cplx(NAN, NAN));
+ assert(std::isnan(nan3.real()));
+ assert(std::isnan(nan3.imag()));
- const cplx inf1 = std::__sqr(cplx(INFINITY, 0));
- assert(std::isinf(inf1.real()));
- assert(inf1.real() > 0);
+ const cplx inf1 = std::__sqr(cplx(INFINITY, 0));
+ assert(std::isinf(inf1.real()));
+ assert(inf1.real() > 0);
- const cplx inf2 = std::__sqr(cplx(0, INFINITY));
- assert(std::isinf(inf2.real()));
- assert(inf2.real() < 0);
+ const cplx inf2 = std::__sqr(cplx(0, INFINITY));
+ assert(std::isinf(inf2.real()));
+ assert(inf2.real() < 0);
}
-int main(int, char**)
-{
- test<float>();
- test<double>();
- test<long double>();
+int main(int, char**) {
+ test<float>();
+ test<double>();
+ test<long double>();
return 0;
}
diff --git a/libcxx/test/libcxx-03/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp b/libcxx/test/libcxx-03/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
index 13d1bfcb8..bb686db55 100644
--- a/libcxx/test/libcxx-03/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
+++ b/libcxx/test/libcxx-03/thread/thread.condition/thread.condition.condvar/native_handle.pass.cpp
@@ -24,13 +24,11 @@
#include "test_macros.h"
-int main(int, char**)
-{
- static_assert((std::is_same<std::condition_variable::native_handle_type,
- pthread_cond_t*>::value), "");
- std::condition_variable cv;
- std::condition_variable::native_handle_type h = cv.native_handle();
- assert(h != nullptr);
+int main(int, char**) {
+ static_assert((std::is_same<std::condition_variable::native_handle_type, pthread_cond_t*>::value), "");
+ std::condition_variable cv;
+ std::condition_variable::native_handle_type h = cv.native_handle();
+ assert(h != nullptr);
return 0;
}
diff --git a/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp b/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
index 3de6635f1..b5d239b9e 100644
--- a/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
+++ b/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/native_handle.pass.cpp
@@ -22,11 +22,10 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::mutex m;
- pthread_mutex_t* h = m.native_handle();
- assert(h);
+int main(int, char**) {
+ std::mutex m;
+ pthread_mutex_t* h = m.native_handle();
+ assert(h);
return 0;
}
diff --git a/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp b/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
index d76b3d71d..aad5e05aa 100644
--- a/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
+++ b/libcxx/test/libcxx-03/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.recursive/native_handle.pass.cpp
@@ -22,11 +22,10 @@
#include "test_macros.h"
-int main(int, char**)
-{
- std::recursive_mutex m;
- pthread_mutex_t* h = m.native_handle();
- assert(h);
+int main(int, char**) {
+ std::recursive_mutex m;
+ pthread_mutex_t* h = m.native_handle();
+ assert(h);
return 0;
}
diff --git a/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
index 96ec33325..870bcafd6 100644
--- a/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
+++ b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/thread.thread.member/native_handle.pass.cpp
@@ -23,37 +23,38 @@
#include "test_macros.h"
-class G
-{
- int alive_;
+class G {
+ int alive_;
+
public:
- static int n_alive;
- static bool op_run;
-
- G() : alive_(1) {++n_alive;}
- G(const G& g) : alive_(g.alive_) {++n_alive;}
- ~G() {alive_ = 0; --n_alive;}
-
- void operator()()
- {
- assert(alive_ == 1);
- assert(n_alive >= 1);
- op_run = true;
- }
+ static int n_alive;
+ static bool op_run;
+
+ G() : alive_(1) { ++n_alive; }
+ G(const G& g) : alive_(g.alive_) { ++n_alive; }
+ ~G() {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()() {
+ assert(alive_ == 1);
+ assert(n_alive >= 1);
+ op_run = true;
+ }
};
int G::n_alive = 0;
bool G::op_run = false;
-int main(int, char**)
-{
- {
- G g;
- std::thread t0(g);
- pthread_t pid = t0.native_handle();
- assert(pid != 0);
- t0.join();
- }
+int main(int, char**) {
+ {
+ G g;
+ std::thread t0(g);
+ pthread_t pid = t0.native_handle();
+ assert(pid != 0);
+ t0.join();
+ }
return 0;
}
diff --git a/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/types.pass.cpp b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/types.pass.cpp
index bb60647ef..a371670c1 100644
--- a/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/types.pass.cpp
+++ b/libcxx/test/libcxx-03/thread/thread.threads/thread.thread.class/types.pass.cpp
@@ -23,9 +23,8 @@
#include "test_macros.h"
-int main(int, char**)
-{
- static_assert((std::is_same<std::thread::native_handle_type, pthread_t>::value), "");
+int main(int, char**) {
+ static_assert((std::is_same<std::thread::native_handle_type, pthread_t>::value), "");
return 0;
}
diff --git a/libcxx/test/libcxx-03/type_traits/convert_to_integral.pass.cpp b/libcxx/test/libcxx-03/type_traits/convert_to_integral.pass.cpp
index f1036b392..4734088d2 100644
--- a/libcxx/test/libcxx-03/type_traits/convert_to_integral.pass.cpp
+++ b/libcxx/test/libcxx-03/type_traits/convert_to_integral.pass.cpp
@@ -28,63 +28,54 @@ TEST_CLANG_DIAGNOSTIC_IGNORED("-Wprivate-header")
#include "user_defined_integral.h"
template <class T>
-struct EnumType
-{
- enum type : T {E_zero, E_one};
+struct EnumType {
+ enum type : T { E_zero, E_one };
};
-
template <class From, class To>
-void check_integral_types()
-{
+void check_integral_types() {
typedef std::numeric_limits<From> Limits;
const From max = Limits::max();
const From min = Limits::min();
{
- auto ret = std::__convert_to_integral((From)max);
- assert(ret == max);
- ret = std::__convert_to_integral((From)min);
- assert(ret == min);
- static_assert(std::is_same<decltype(ret), To>::value, "");
+ auto ret = std::__convert_to_integral((From)max);
+ assert(ret == max);
+ ret = std::__convert_to_integral((From)min);
+ assert(ret == min);
+ static_assert(std::is_same<decltype(ret), To>::value, "");
}
{
- UserDefinedIntegral<From> f(max);
- auto ret = std::__convert_to_integral(f);
- assert(ret == max);
- f.value = min;
- ret = std::__convert_to_integral(f);
- assert(ret == min);
- static_assert(std::is_same<decltype(ret), To>::value, "");
+ UserDefinedIntegral<From> f(max);
+ auto ret = std::__convert_to_integral(f);
+ assert(ret == max);
+ f.value = min;
+ ret = std::__convert_to_integral(f);
+ assert(ret == min);
+ static_assert(std::is_same<decltype(ret), To>::value, "");
}
{
- typedef typename EnumType<From>::type Enum;
- Enum e(static_cast<Enum>(max));
- auto ret = std::__convert_to_integral(e);
- assert(ret == max);
- e = static_cast<Enum>(min);
- ret = std::__convert_to_integral(min);
- assert(ret == min);
- static_assert(std::is_same<decltype(ret), To>::value, "");
+ typedef typename EnumType<From>::type Enum;
+ Enum e(static_cast<Enum>(max));
+ auto ret = std::__convert_to_integral(e);
+ assert(ret == max);
+ e = static_cast<Enum>(min);
+ ret = std::__convert_to_integral(min);
+ assert(ret == min);
+ static_assert(std::is_same<decltype(ret), To>::value, "");
}
}
-
template <class From, class To>
-void check_enum_types()
-{
+void check_enum_types() {
auto ret = std::__convert_to_integral((From)1);
assert(ret == 1);
static_assert(std::is_same<decltype(ret), To>::value, "");
}
-
enum enum1 { zero = 0, one = 1 };
-enum enum2 : unsigned long {
- value = std::numeric_limits<unsigned long>::max()
-};
+enum enum2 : unsigned long { value = std::numeric_limits<unsigned long>::max() };
-int main(int, char**)
-{
+int main(int, char**) {
check_integral_types<bool, int>();
check_integral_types<char, int>();
check_integral_types<signed char, int>();
@@ -98,8 +89,8 @@ int main(int, char**)
// char32_t must promote to an unsigned int on these platforms [conv.prom].
// Use the following logic to make the test work on such platforms.
// (sizeof(std::uint32_t) == sizeof(unsigned int)) ? unsigned int : std::uint32_t;
- typedef std::conditional<sizeof(std::uint32_t) == sizeof(unsigned int),
- unsigned int, std::uint32_t>::type char_integral;
+ typedef std::conditional<sizeof(std::uint32_t) == sizeof(unsigned int), unsigned int, std::uint32_t>::type
+ char_integral;
check_integral_types<char32_t, char_integral>();
check_integral_types<short, int>();
check_integral_types<unsigned short, int>();
@@ -113,7 +104,7 @@ int main(int, char**)
check_integral_types<__int128_t, __int128_t>();
check_integral_types<__uint128_t, __uint128_t>();
#endif
- // TODO(ericwf): Not standard
+ // TODO(ericwf): Not standard
typedef std::underlying_type<enum1>::type Enum1UT;
check_enum_types<enum1, decltype(((Enum1UT)1) + 1)>();
typedef std::underlying_type<enum2>::type Enum2UT;
diff --git a/libcxx/test/libcxx-03/type_traits/is_callable.compile.pass.cpp b/libcxx/test/libcxx-03/type_traits/is_callable.compile.pass.cpp
index d7bd701aa..f72c4413c 100644
--- a/libcxx/test/libcxx-03/type_traits/is_callable.compile.pass.cpp
+++ b/libcxx/test/libcxx-03/type_traits/is_callable.compile.pass.cpp
@@ -25,7 +25,6 @@ struct ArgumentFunctor {
static_assert(std::__is_callable<Functor>::value, "");
static_assert(std::__is_callable<decltype(func)>::value, "");
static_assert(!std::__is_callable<NotFunctor>::value, "");
-static_assert(!std::__is_callable<NotFunctor,
- decltype(&NotFunctor::compare)>::value, "");
+static_assert(!std::__is_callable<NotFunctor, decltype(&NotFunctor::compare)>::value, "");
static_assert(std::__is_callable<ArgumentFunctor, int, int>::value, "");
static_assert(!std::__is_callable<ArgumentFunctor, int>::value, "");
diff --git a/libcxx/test/libcxx-03/type_traits/is_constant_evaluated.pass.cpp b/libcxx/test/libcxx-03/type_traits/is_constant_evaluated.pass.cpp
index a538c52a5..c3f517dd1 100644
--- a/libcxx/test/libcxx-03/type_traits/is_constant_evaluated.pass.cpp
+++ b/libcxx/test/libcxx-03/type_traits/is_constant_evaluated.pass.cpp
@@ -21,16 +21,16 @@
#include "test_macros.h"
-int main (int, char**) {
- ASSERT_SAME_TYPE(decltype(std::__libcpp_is_constant_evaluated()), bool);
- ASSERT_NOEXCEPT(std::__libcpp_is_constant_evaluated());
+int main(int, char**) {
+ ASSERT_SAME_TYPE(decltype(std::__libcpp_is_constant_evaluated()), bool);
+ ASSERT_NOEXCEPT(std::__libcpp_is_constant_evaluated());
#if !defined(_LIBCPP_CXX03_LANG)
- static_assert(std::__libcpp_is_constant_evaluated(), "");
+ static_assert(std::__libcpp_is_constant_evaluated(), "");
#endif
- bool p = std::__libcpp_is_constant_evaluated();
- assert(!p);
+ bool p = std::__libcpp_is_constant_evaluated();
+ assert(!p);
- return 0;
- }
+ return 0;
+}
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
index 48460d148..89667072d 100644
--- a/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_1_2_3.pass.cpp
@@ -66,67 +66,68 @@
//==============================================================================
// MemFun03 - C++03 compatible set of test member functions.
struct MemFun03 {
- typedef void*& R;
-#define F(...) \
- R f(__VA_ARGS__) { return MethodID<R(MemFun03::*)(__VA_ARGS__)>::setUncheckedCall(); } \
- R f(__VA_ARGS__) const { return MethodID<R(MemFun03::*)(__VA_ARGS__) const>::setUncheckedCall(); } \
- R f(__VA_ARGS__) volatile { return MethodID<R(MemFun03::*)(__VA_ARGS__) volatile>::setUncheckedCall(); } \
- R f(__VA_ARGS__) const volatile { return MethodID<R(MemFun03::*)(__VA_ARGS__) const volatile>::setUncheckedCall(); }
+ typedef void*& R;
+#define F(...) \
+ R f(__VA_ARGS__) { return MethodID<R (MemFun03::*)(__VA_ARGS__)>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const { return MethodID<R (MemFun03::*)(__VA_ARGS__) const>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) volatile { return MethodID<R (MemFun03::*)(__VA_ARGS__) volatile>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const volatile { return MethodID<R (MemFun03::*)(__VA_ARGS__) const volatile>::setUncheckedCall(); }
#
- F()
- F(...)
- F(ArgType&)
- F(ArgType&, ...)
- F(ArgType&, ArgType&)
- F(ArgType&, ArgType&, ...)
- F(ArgType&, ArgType&, ArgType&)
- F(ArgType&, ArgType&, ArgType&, ...)
+ F()
+ F(...)
+ F(ArgType&)
+ F(ArgType&, ...)
+ F(ArgType&, ArgType&)
+ F(ArgType&, ArgType&, ...)
+ F(ArgType&, ArgType&, ArgType&)
+ F(ArgType&, ArgType&, ArgType&, ...)
#undef F
+
public:
- MemFun03() {}
+ MemFun03() {}
+
private:
- MemFun03(MemFun03 const&);
- MemFun03& operator=(MemFun03 const&);
+ MemFun03(MemFun03 const&);
+ MemFun03& operator=(MemFun03 const&);
};
-
#if TEST_STD_VER >= 11
//==============================================================================
// MemFun11 - C++11 reference qualified test member functions.
struct MemFun11 {
- typedef void*& R;
- typedef MemFun11 C;
-#define F(...) \
- R f(__VA_ARGS__) & { return MethodID<R(C::*)(__VA_ARGS__) &>::setUncheckedCall(); } \
- R f(__VA_ARGS__) const & { return MethodID<R(C::*)(__VA_ARGS__) const &>::setUncheckedCall(); } \
- R f(__VA_ARGS__) volatile & { return MethodID<R(C::*)(__VA_ARGS__) volatile &>::setUncheckedCall(); } \
- R f(__VA_ARGS__) const volatile & { return MethodID<R(C::*)(__VA_ARGS__) const volatile &>::setUncheckedCall(); } \
- R f(__VA_ARGS__) && { return MethodID<R(C::*)(__VA_ARGS__) &&>::setUncheckedCall(); } \
- R f(__VA_ARGS__) const && { return MethodID<R(C::*)(__VA_ARGS__) const &&>::setUncheckedCall(); } \
- R f(__VA_ARGS__) volatile && { return MethodID<R(C::*)(__VA_ARGS__) volatile &&>::setUncheckedCall(); } \
- R f(__VA_ARGS__) const volatile && { return MethodID<R(C::*)(__VA_ARGS__) const volatile &&>::setUncheckedCall(); }
+ typedef void*& R;
+ typedef MemFun11 C;
+# define F(...) \
+ R f(__VA_ARGS__) & { return MethodID<R (C::*)(__VA_ARGS__) &>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const& { return MethodID<R (C::*)(__VA_ARGS__) const&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) volatile& { return MethodID<R (C::*)(__VA_ARGS__) volatile&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const volatile& { return MethodID<R (C::*)(__VA_ARGS__) const volatile&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) && { return MethodID<R (C::*)(__VA_ARGS__) &&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const&& { return MethodID<R (C::*)(__VA_ARGS__) const&&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) volatile&& { return MethodID<R (C::*)(__VA_ARGS__) volatile&&>::setUncheckedCall(); } \
+ R f(__VA_ARGS__) const volatile&& { return MethodID<R (C::*)(__VA_ARGS__) const volatile&&>::setUncheckedCall(); }
#
- F()
- F(...)
- F(ArgType&&)
- F(ArgType&&, ...)
- F(ArgType&&, ArgType&&)
- F(ArgType&&, ArgType&&, ...)
- F(ArgType&&, ArgType&&, ArgType&&)
- F(ArgType&&, ArgType&&, ArgType&&, ...)
-#undef F
+ F()
+ F(...)
+ F(ArgType&&)
+ F(ArgType&&, ...)
+ F(ArgType&&, ArgType&&)
+ F(ArgType&&, ArgType&&, ...)
+ F(ArgType&&, ArgType&&, ArgType&&)
+ F(ArgType&&, ArgType&&, ArgType&&, ...)
+# undef F
+
public:
- MemFun11() {}
+ MemFun11() {}
+
private:
- MemFun11(MemFun11 const&);
- MemFun11& operator=(MemFun11 const&);
+ MemFun11(MemFun11 const&);
+ MemFun11& operator=(MemFun11 const&);
};
#endif // TEST_STD_VER >= 11
-
-
//==============================================================================
// TestCase - A test case for a single member function.
// ClassType - The type of the class being tested.
@@ -135,108 +136,104 @@ private:
// CV - the cv qualifiers of 'CallSig' represented as a type tag.
// RValue - The method is RValue qualified.
// ArgRValue - Call the method with RValue arguments.
-template <class ClassType, class CallSig, int Arity, class CV,
- bool RValue = false, bool ArgRValue = false>
+template <class ClassType, class CallSig, int Arity, class CV, bool RValue = false, bool ArgRValue = false>
struct TestCaseImp {
public:
-
- static void run() { TestCaseImp().doTest(); }
+ static void run() { TestCaseImp().doTest(); }
private:
- //==========================================================================
- // TEST DISPATCH
- void doTest() {
- // (Plan-2) Create test call objects.
- typedef ClassType T;
- typedef DerivedFromType<T> D;
- T obj;
- T* obj_ptr = &obj;
- D der;
- D* der_ptr = &der;
- DerefToType<T> dref;
- DerefPropType<T> dref2;
- std::reference_wrapper<T> rref(obj);
- std::reference_wrapper<D> drref(der);
-
- // (Plan-3) Dispatch based on the CV tags.
- CV tag;
- Bool<!RValue> NotRValue;
- runTestDispatch(tag, obj);
- runTestDispatch(tag, der);
- runTestDispatch(tag, dref2);
- runTestDispatchIf(NotRValue, tag, dref);
- runTestDispatchIf(NotRValue, tag, obj_ptr);
- runTestDispatchIf(NotRValue, tag, der_ptr);
+ //==========================================================================
+ // TEST DISPATCH
+ void doTest() {
+ // (Plan-2) Create test call objects.
+ typedef ClassType T;
+ typedef DerivedFromType<T> D;
+ T obj;
+ T* obj_ptr = &obj;
+ D der;
+ D* der_ptr = &der;
+ DerefToType<T> dref;
+ DerefPropType<T> dref2;
+ std::reference_wrapper<T> rref(obj);
+ std::reference_wrapper<D> drref(der);
+
+ // (Plan-3) Dispatch based on the CV tags.
+ CV tag;
+ Bool<!RValue> NotRValue;
+ runTestDispatch(tag, obj);
+ runTestDispatch(tag, der);
+ runTestDispatch(tag, dref2);
+ runTestDispatchIf(NotRValue, tag, dref);
+ runTestDispatchIf(NotRValue, tag, obj_ptr);
+ runTestDispatchIf(NotRValue, tag, der_ptr);
#if TEST_STD_VER >= 11
- runTestDispatchIf(NotRValue, tag, rref);
- runTestDispatchIf(NotRValue, tag, drref);
+ runTestDispatchIf(NotRValue, tag, rref);
+ runTestDispatchIf(NotRValue, tag, drref);
#endif
- }
-
- template <class QT, class Tp>
- void runTestDispatchIf(Bool<true>, QT q, Tp& v) {
- runTestDispatch(q, v);
- }
-
- template <class QT, class Tp>
- void runTestDispatchIf(Bool<false>, QT, Tp&) {
- }
-
- template <class Tp>
- void runTestDispatch(Q_None, Tp& v) {
- runTest(v);
- }
-
- template <class Tp>
- void runTestDispatch(Q_Const, Tp& v) {
- runTest(v);
- runTest(makeConst(v));
- }
-
- template <class Tp>
- void runTestDispatch(Q_Volatile, Tp& v) {
- runTest(v);
- runTest(makeVolatile(v));
-
- }
-
- template <class Tp>
- void runTestDispatch(Q_CV, Tp& v) {
- runTest(v);
- runTest(makeConst(v));
- runTest(makeVolatile(v));
- runTest(makeCV(v));
- }
-
- template <class T>
- void runTest(const std::reference_wrapper<T>& obj) {
- typedef Caster<Q_None, RValue> SCast;
- typedef Caster<Q_None, ArgRValue> ACast;
- typedef CallSig (ClassType::*MemPtr);
- // Delegate test to logic in invoke_helpers.h
- BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
- b.runTest( (MemPtr)&ClassType::f, obj);
- }
-
- template <class T>
- void runTest(T* obj) {
- typedef Caster<Q_None, RValue> SCast;
- typedef Caster<Q_None, ArgRValue> ACast;
- typedef CallSig (ClassType::*MemPtr);
- // Delegate test to logic in invoke_helpers.h
- BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
- b.runTest( (MemPtr)&ClassType::f, obj);
- }
-
- template <class Obj>
- void runTest(Obj& obj) {
- typedef Caster<Q_None, RValue> SCast;
- typedef Caster<Q_None, ArgRValue> ACast;
- typedef CallSig (ClassType::*MemPtr);
- // Delegate test to logic in invoke_helpers.h
- BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
- b.runTest( (MemPtr)&ClassType::f, obj);
- }
+ }
+
+ template <class QT, class Tp>
+ void runTestDispatchIf(Bool<true>, QT q, Tp& v) {
+ runTestDispatch(q, v);
+ }
+
+ template <class QT, class Tp>
+ void runTestDispatchIf(Bool<false>, QT, Tp&) {}
+
+ template <class Tp>
+ void runTestDispatch(Q_None, Tp& v) {
+ runTest(v);
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_Const, Tp& v) {
+ runTest(v);
+ runTest(makeConst(v));
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_Volatile, Tp& v) {
+ runTest(v);
+ runTest(makeVolatile(v));
+ }
+
+ template <class Tp>
+ void runTestDispatch(Q_CV, Tp& v) {
+ runTest(v);
+ runTest(makeConst(v));
+ runTest(makeVolatile(v));
+ runTest(makeCV(v));
+ }
+
+ template <class T>
+ void runTest(const std::reference_wrapper<T>& obj) {
+ typedef Caster<Q_None, RValue> SCast;
+ typedef Caster<Q_None, ArgRValue> ACast;
+ typedef CallSig(ClassType::* MemPtr);
+ // Delegate test to logic in invoke_helpers.h
+ BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
+ b.runTest((MemPtr)&ClassType::f, obj);
+ }
+
+ template <class T>
+ void runTest(T* obj) {
+ typedef Caster<Q_None, RValue> SCast;
+ typedef Caster<Q_None, ArgRValue> ACast;
+ typedef CallSig(ClassType::* MemPtr);
+ // Delegate test to logic in invoke_helpers.h
+ BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
+ b.runTest((MemPtr)&ClassType::f, obj);
+ }
+
+ template <class Obj>
+ void runTest(Obj& obj) {
+ typedef Caster<Q_None, RValue> SCast;
+ typedef Caster<Q_None, ArgRValue> ACast;
+ typedef CallSig(ClassType::* MemPtr);
+ // Delegate test to logic in invoke_helpers.h
+ BasicTest<MethodID<MemPtr>, Arity, SCast, ACast> b;
+ b.runTest((MemPtr)&ClassType::f, obj);
+ }
};
template <class Sig, int Arity, class CV>
@@ -248,23 +245,22 @@ struct TestCase11 : public TestCaseImp<MemFun11, Sig, Arity, CV, RValue, true> {
template <class Type>
struct ReferenceWrapper {
- using type = Type;
- Type* ptr;
+ using type = Type;
+ Type* ptr;
- static void fun(Type&) noexcept;
- static void fun(Type&&) = delete;
+ static void fun(Type&) noexcept;
+ static void fun(Type&&) = delete;
- template <class Type2,
- class = typename std::enable_if<!std::__is_same_uncvref<Type2, ReferenceWrapper>::value>::type>
- constexpr ReferenceWrapper(Type2&& t) noexcept : ptr(&t) {}
+ template <class Type2, class = typename std::enable_if<!std::__is_same_uncvref<Type2, ReferenceWrapper>::value>::type>
+ constexpr ReferenceWrapper(Type2&& t) noexcept : ptr(&t) {}
- constexpr Type& get() const noexcept { return *ptr; }
- constexpr operator Type&() const noexcept { return *ptr; }
+ constexpr Type& get() const noexcept { return *ptr; }
+ constexpr operator Type&() const noexcept { return *ptr; }
- template <class... _ArgTypes>
- constexpr std::__invoke_result_t<Type&, _ArgTypes...> operator()(_ArgTypes&&... __args) const {
- return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
- }
+ template <class... _ArgTypes>
+ constexpr std::__invoke_result_t<Type&, _ArgTypes...> operator()(_ArgTypes&&... __args) const {
+ return std::__invoke(get(), std::forward<_ArgTypes>(__args)...);
+ }
};
template <class Tp>
@@ -273,132 +269,132 @@ struct DerivedFromRefWrap : public ReferenceWrapper<Tp> {
};
TEST_CONSTEXPR_CXX14 bool test_derived_from_ref_wrap() {
- int x = 42;
- ReferenceWrapper<int> r(x);
- DerivedFromRefWrap<int> d(x);
- auto get_fn = &ReferenceWrapper<int>::get;
- auto& ret = std::__invoke(get_fn, r);
- assert(&ret == &x);
- auto& ret2 = std::__invoke(get_fn, d);
- assert(&ret2 == &x);
-
- return true;
+ int x = 42;
+ ReferenceWrapper<int> r(x);
+ DerivedFromRefWrap<int> d(x);
+ auto get_fn = &ReferenceWrapper<int>::get;
+ auto& ret = std::__invoke(get_fn, r);
+ assert(&ret == &x);
+ auto& ret2 = std::__invoke(get_fn, d);
+ assert(&ret2 == &x);
+
+ return true;
}
TEST_CONSTEXPR_CXX20 bool test_reference_wrapper_reference_wrapper() {
- int x = 42;
- auto get_fn = &std::reference_wrapper<int>::get;
- std::reference_wrapper<int> r(x);
- std::reference_wrapper<std::reference_wrapper<int>> r2(r);
- auto& ret3 = std::__invoke(get_fn, r2);
- assert(&ret3 == &x);
-
- return true;
+ int x = 42;
+ auto get_fn = &std::reference_wrapper<int>::get;
+ std::reference_wrapper<int> r(x);
+ std::reference_wrapper<std::reference_wrapper<int>> r2(r);
+ auto& ret3 = std::__invoke(get_fn, r2);
+ assert(&ret3 == &x);
+
+ return true;
}
#endif
int main(int, char**) {
- typedef void*& R;
- typedef ArgType A;
- TestCase<R(), 0, Q_None>::run();
- TestCase<R() const, 0, Q_Const>::run();
- TestCase<R() volatile, 0, Q_Volatile>::run();
- TestCase<R() const volatile, 0, Q_CV>::run();
- TestCase<R(...), 0, Q_None>::run();
- TestCase<R(...) const, 0, Q_Const>::run();
- TestCase<R(...) volatile, 0, Q_Volatile>::run();
- TestCase<R(...) const volatile, 0, Q_CV>::run();
- TestCase<R(A&), 1, Q_None>::run();
- TestCase<R(A&) const, 1, Q_Const>::run();
- TestCase<R(A&) volatile, 1, Q_Volatile>::run();
- TestCase<R(A&) const volatile, 1, Q_CV>::run();
- TestCase<R(A&, ...), 1, Q_None>::run();
- TestCase<R(A&, ...) const, 1, Q_Const>::run();
- TestCase<R(A&, ...) volatile, 1, Q_Volatile>::run();
- TestCase<R(A&, ...) const volatile, 1, Q_CV>::run();
- TestCase<R(A&, A&), 2, Q_None>::run();
- TestCase<R(A&, A&) const, 2, Q_Const>::run();
- TestCase<R(A&, A&) volatile, 2, Q_Volatile>::run();
- TestCase<R(A&, A&) const volatile, 2, Q_CV>::run();
- TestCase<R(A&, A&, ...), 2, Q_None>::run();
- TestCase<R(A&, A&, ...) const, 2, Q_Const>::run();
- TestCase<R(A&, A&, ...) volatile, 2, Q_Volatile>::run();
- TestCase<R(A&, A&, ...) const volatile, 2, Q_CV>::run();
- TestCase<R(A&, A&, A&), 3, Q_None>::run();
- TestCase<R(A&, A&, A&) const, 3, Q_Const>::run();
- TestCase<R(A&, A&, A&) volatile, 3, Q_Volatile>::run();
- TestCase<R(A&, A&, A&) const volatile, 3, Q_CV>::run();
- TestCase<R(A&, A&, A&, ...), 3, Q_None>::run();
- TestCase<R(A&, A&, A&, ...) const, 3, Q_Const>::run();
- TestCase<R(A&, A&, A&, ...) volatile, 3, Q_Volatile>::run();
- TestCase<R(A&, A&, A&, ...) const volatile, 3, Q_CV>::run();
+ typedef void*& R;
+ typedef ArgType A;
+ TestCase<R(), 0, Q_None>::run();
+ TestCase<R() const, 0, Q_Const>::run();
+ TestCase<R() volatile, 0, Q_Volatile>::run();
+ TestCase<R() const volatile, 0, Q_CV>::run();
+ TestCase<R(...), 0, Q_None>::run();
+ TestCase<R(...) const, 0, Q_Const>::run();
+ TestCase<R(...) volatile, 0, Q_Volatile>::run();
+ TestCase<R(...) const volatile, 0, Q_CV>::run();
+ TestCase<R(A&), 1, Q_None>::run();
+ TestCase<R(A&) const, 1, Q_Const>::run();
+ TestCase<R(A&) volatile, 1, Q_Volatile>::run();
+ TestCase<R(A&) const volatile, 1, Q_CV>::run();
+ TestCase<R(A&, ...), 1, Q_None>::run();
+ TestCase<R(A&, ...) const, 1, Q_Const>::run();
+ TestCase<R(A&, ...) volatile, 1, Q_Volatile>::run();
+ TestCase<R(A&, ...) const volatile, 1, Q_CV>::run();
+ TestCase<R(A&, A&), 2, Q_None>::run();
+ TestCase<R(A&, A&) const, 2, Q_Const>::run();
+ TestCase<R(A&, A&) volatile, 2, Q_Volatile>::run();
+ TestCase<R(A&, A&) const volatile, 2, Q_CV>::run();
+ TestCase<R(A&, A&, ...), 2, Q_None>::run();
+ TestCase<R(A&, A&, ...) const, 2, Q_Const>::run();
+ TestCase<R(A&, A&, ...) volatile, 2, Q_Volatile>::run();
+ TestCase<R(A&, A&, ...) const volatile, 2, Q_CV>::run();
+ TestCase<R(A&, A&, A&), 3, Q_None>::run();
+ TestCase<R(A&, A&, A&) const, 3, Q_Const>::run();
+ TestCase<R(A&, A&, A&) volatile, 3, Q_Volatile>::run();
+ TestCase<R(A&, A&, A&) const volatile, 3, Q_CV>::run();
+ TestCase<R(A&, A&, A&, ...), 3, Q_None>::run();
+ TestCase<R(A&, A&, A&, ...) const, 3, Q_Const>::run();
+ TestCase<R(A&, A&, A&, ...) volatile, 3, Q_Volatile>::run();
+ TestCase<R(A&, A&, A&, ...) const volatile, 3, Q_CV>::run();
#if TEST_STD_VER >= 11
- TestCase11<R() &, 0, Q_None>::run();
- TestCase11<R() const &, 0, Q_Const>::run();
- TestCase11<R() volatile &, 0, Q_Volatile>::run();
- TestCase11<R() const volatile &, 0, Q_CV>::run();
- TestCase11<R(...) &, 0, Q_None>::run();
- TestCase11<R(...) const &, 0, Q_Const>::run();
- TestCase11<R(...) volatile &, 0, Q_Volatile>::run();
- TestCase11<R(...) const volatile &, 0, Q_CV>::run();
- TestCase11<R(A&&) &, 1, Q_None>::run();
- TestCase11<R(A&&) const &, 1, Q_Const>::run();
- TestCase11<R(A&&) volatile &, 1, Q_Volatile>::run();
- TestCase11<R(A&&) const volatile &, 1, Q_CV>::run();
- TestCase11<R(A&&, ...) &, 1, Q_None>::run();
- TestCase11<R(A&&, ...) const &, 1, Q_Const>::run();
- TestCase11<R(A&&, ...) volatile &, 1, Q_Volatile>::run();
- TestCase11<R(A&&, ...) const volatile &, 1, Q_CV>::run();
- TestCase11<R(A&&, A&&) &, 2, Q_None>::run();
- TestCase11<R(A&&, A&&) const &, 2, Q_Const>::run();
- TestCase11<R(A&&, A&&) volatile &, 2, Q_Volatile>::run();
- TestCase11<R(A&&, A&&) const volatile &, 2, Q_CV>::run();
- TestCase11<R(A&&, A&&, ...) &, 2, Q_None>::run();
- TestCase11<R(A&&, A&&, ...) const &, 2, Q_Const>::run();
- TestCase11<R(A&&, A&&, ...) volatile &, 2, Q_Volatile>::run();
- TestCase11<R(A&&, A&&, ...) const volatile &, 2, Q_CV>::run();
- TestCase11<R() &&, 0, Q_None, /* RValue */ true>::run();
- TestCase11<R() const &&, 0, Q_Const, /* RValue */ true>::run();
- TestCase11<R() volatile &&, 0, Q_Volatile, /* RValue */ true>::run();
- TestCase11<R() const volatile &&, 0, Q_CV, /* RValue */ true>::run();
- TestCase11<R(...) &&, 0, Q_None, /* RValue */ true>::run();
- TestCase11<R(...) const &&, 0, Q_Const, /* RValue */ true>::run();
- TestCase11<R(...) volatile &&, 0, Q_Volatile, /* RValue */ true>::run();
- TestCase11<R(...) const volatile &&, 0, Q_CV, /* RValue */ true>::run();
- TestCase11<R(A&&) &&, 1, Q_None, /* RValue */ true>::run();
- TestCase11<R(A&&) const &&, 1, Q_Const, /* RValue */ true>::run();
- TestCase11<R(A&&) volatile &&, 1, Q_Volatile, /* RValue */ true>::run();
- TestCase11<R(A&&) const volatile &&, 1, Q_CV, /* RValue */ true>::run();
- TestCase11<R(A&&, ...) &&, 1, Q_None, /* RValue */ true>::run();
- TestCase11<R(A&&, ...) const &&, 1, Q_Const, /* RValue */ true>::run();
- TestCase11<R(A&&, ...) volatile &&, 1, Q_Volatile, /* RValue */ true>::run();
- TestCase11<R(A&&, ...) const volatile &&, 1, Q_CV, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&) &&, 2, Q_None, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&) const &&, 2, Q_Const, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&) volatile &&, 2, Q_Volatile, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&) const volatile &&, 2, Q_CV, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, ...) &&, 2, Q_None, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, ...) const &&, 2, Q_Const, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, ...) volatile &&, 2, Q_Volatile, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, ...) const volatile &&, 2, Q_CV, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, A&&) &&, 3, Q_None, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, A&&) const &&, 3, Q_Const, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, A&&) volatile &&, 3, Q_Volatile, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, A&&) const volatile &&, 3, Q_CV, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, A&&, ...) &&, 3, Q_None, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, A&&, ...) const &&, 3, Q_Const, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, A&&, ...) volatile &&, 3, Q_Volatile, /* RValue */ true>::run();
- TestCase11<R(A&&, A&&, A&&, ...) const volatile &&, 3, Q_CV, /* RValue */ true>::run();
-
- test_derived_from_ref_wrap();
- test_reference_wrapper_reference_wrapper();
-#if TEST_STD_VER > 11
- static_assert(test_derived_from_ref_wrap(), "");
-#endif
-#if TEST_STD_VER > 17
- static_assert(test_reference_wrapper_reference_wrapper(), "");
-#endif
+ TestCase11<R() &, 0, Q_None>::run();
+ TestCase11<R() const&, 0, Q_Const>::run();
+ TestCase11<R() volatile&, 0, Q_Volatile>::run();
+ TestCase11<R() const volatile&, 0, Q_CV>::run();
+ TestCase11<R(...) &, 0, Q_None>::run();
+ TestCase11<R(...) const&, 0, Q_Const>::run();
+ TestCase11<R(...) volatile&, 0, Q_Volatile>::run();
+ TestCase11<R(...) const volatile&, 0, Q_CV>::run();
+ TestCase11<R(A&&) &, 1, Q_None>::run();
+ TestCase11<R(A&&) const&, 1, Q_Const>::run();
+ TestCase11<R(A&&) volatile&, 1, Q_Volatile>::run();
+ TestCase11<R(A&&) const volatile&, 1, Q_CV>::run();
+ TestCase11<R(A&&, ...) &, 1, Q_None>::run();
+ TestCase11<R(A&&, ...) const&, 1, Q_Const>::run();
+ TestCase11<R(A&&, ...) volatile&, 1, Q_Volatile>::run();
+ TestCase11<R(A&&, ...) const volatile&, 1, Q_CV>::run();
+ TestCase11<R(A&&, A&&) &, 2, Q_None>::run();
+ TestCase11<R(A&&, A&&) const&, 2, Q_Const>::run();
+ TestCase11<R(A&&, A&&) volatile&, 2, Q_Volatile>::run();
+ TestCase11<R(A&&, A&&) const volatile&, 2, Q_CV>::run();
+ TestCase11<R(A&&, A&&, ...) &, 2, Q_None>::run();
+ TestCase11<R(A&&, A&&, ...) const&, 2, Q_Const>::run();
+ TestCase11<R(A&&, A&&, ...) volatile&, 2, Q_Volatile>::run();
+ TestCase11<R(A&&, A&&, ...) const volatile&, 2, Q_CV>::run();
+ TestCase11<R() &&, 0, Q_None, /* RValue */ true>::run();
+ TestCase11<R() const&&, 0, Q_Const, /* RValue */ true>::run();
+ TestCase11<R() volatile&&, 0, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R() const volatile&&, 0, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(...) &&, 0, Q_None, /* RValue */ true>::run();
+ TestCase11<R(...) const&&, 0, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(...) volatile&&, 0, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(...) const volatile&&, 0, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&) &&, 1, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&) const&&, 1, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&) volatile&&, 1, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&) const volatile&&, 1, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) &&, 1, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) const&&, 1, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) volatile&&, 1, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, ...) const volatile&&, 1, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) &&, 2, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) const&&, 2, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) volatile&&, 2, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&) const volatile&&, 2, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) &&, 2, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) const&&, 2, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) volatile&&, 2, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, ...) const volatile&&, 2, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) &&, 3, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) const&&, 3, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) volatile&&, 3, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&) const volatile&&, 3, Q_CV, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) &&, 3, Q_None, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) const&&, 3, Q_Const, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) volatile&&, 3, Q_Volatile, /* RValue */ true>::run();
+ TestCase11<R(A&&, A&&, A&&, ...) const volatile&&, 3, Q_CV, /* RValue */ true>::run();
+
+ test_derived_from_ref_wrap();
+ test_reference_wrapper_reference_wrapper();
+# if TEST_STD_VER > 11
+ static_assert(test_derived_from_ref_wrap(), "");
+# endif
+# if TEST_STD_VER > 17
+ static_assert(test_reference_wrapper_reference_wrapper(), "");
+# endif
#endif // TEST_STD_VER >= 11
return 0;
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp
index 0df592908..7e5c18754 100644
--- a/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_4_5_6.pass.cpp
@@ -47,164 +47,160 @@
template <class Tp>
struct TestMemberObject {
- TestMemberObject() : object() {}
- Tp object;
+ TestMemberObject() : object() {}
+ Tp object;
+
private:
- TestMemberObject(TestMemberObject const&);
- TestMemberObject& operator=(TestMemberObject const&);
+ TestMemberObject(TestMemberObject const&);
+ TestMemberObject& operator=(TestMemberObject const&);
};
template <class ObjectType>
struct TestCase {
- public:
-
- static void run() { TestCase().doTest(); }
+public:
+ static void run() { TestCase().doTest(); }
private:
- typedef TestMemberObject<ObjectType> TestType;
-
- //==========================================================================
- // TEST DISPATCH
- void doTest() {
- typedef DerivedFromType<TestType> Derived;
- TestType obj;
- TestType* obj_ptr = &obj;
- Derived der;
- Derived* der_ptr = &der;
- DerefToType<TestType> dref;
- DerefPropType<TestType> dref2;
- std::reference_wrapper<TestType> rref(obj);
- std::reference_wrapper<Derived> drref(der);
-
- {
- typedef ObjectType (TestType::*MemPtr);
- typedef ObjectType E;
- MemPtr M = &TestType::object;
- runTestDispatch<E>(M, obj, &obj.object);
- runTestDispatch<E>(M, der, &der.object);
- runTestDispatch<E>(M, dref2, &dref2.object.object);
- runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
- runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+ typedef TestMemberObject<ObjectType> TestType;
+
+ //==========================================================================
+ // TEST DISPATCH
+ void doTest() {
+ typedef DerivedFromType<TestType> Derived;
+ TestType obj;
+ TestType* obj_ptr = &obj;
+ Derived der;
+ Derived* der_ptr = &der;
+ DerefToType<TestType> dref;
+ DerefPropType<TestType> dref2;
+ std::reference_wrapper<TestType> rref(obj);
+ std::reference_wrapper<Derived> drref(der);
+
+ {
+ typedef ObjectType(TestType::* MemPtr);
+ typedef ObjectType E;
+ MemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
#if TEST_STD_VER >= 11
- runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
- runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
#endif
- runTestNoPropDispatch<E>(M, dref, &dref.object.object);
- }
- {
- typedef ObjectType const (TestType::*CMemPtr);
- typedef ObjectType const E;
- CMemPtr M = &TestType::object;
- runTestDispatch<E>(M, obj, &obj.object);
- runTestDispatch<E>(M, der, &der.object);
- runTestDispatch<E>(M, dref2, &dref2.object.object);
- runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
- runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
+ }
+ {
+ typedef ObjectType const(TestType::* CMemPtr);
+ typedef ObjectType const E;
+ CMemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
#if TEST_STD_VER >= 11
- runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
- runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
#endif
- runTestNoPropDispatch<E>(M, dref, &dref.object.object);
- }
- {
- typedef ObjectType volatile (TestType::*VMemPtr);
- typedef ObjectType volatile E;
- VMemPtr M = &TestType::object;
- runTestDispatch<E>(M, obj, &obj.object);
- runTestDispatch<E>(M, der, &der.object);
- runTestDispatch<E>(M, dref2, &dref2.object.object);
- runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
- runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
+ }
+ {
+ typedef ObjectType volatile(TestType::* VMemPtr);
+ typedef ObjectType volatile E;
+ VMemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
#if TEST_STD_VER >= 11
- runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
- runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
#endif
- runTestNoPropDispatch<E>(M, dref, &dref.object.object);
- }
- {
- typedef ObjectType const volatile (TestType::*CVMemPtr);
- typedef ObjectType const volatile E;
- CVMemPtr M = &TestType::object;
- runTestDispatch<E>(M, obj, &obj.object);
- runTestDispatch<E>(M, der, &der.object);
- runTestDispatch<E>(M, dref2, &dref2.object.object);
- runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
- runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
+ }
+ {
+ typedef ObjectType const volatile(TestType::* CVMemPtr);
+ typedef ObjectType const volatile E;
+ CVMemPtr M = &TestType::object;
+ runTestDispatch<E>(M, obj, &obj.object);
+ runTestDispatch<E>(M, der, &der.object);
+ runTestDispatch<E>(M, dref2, &dref2.object.object);
+ runTestPropCVDispatch<E>(M, obj_ptr, &obj_ptr->object);
+ runTestPropCVDispatch<E>(M, der_ptr, &der_ptr->object);
#if TEST_STD_VER >= 11
- runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
- runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
+ runTestPropCVDispatch<E>(M, rref, &(rref.get().object));
+ runTestPropCVDispatch<E>(M, drref, &(drref.get().object));
#endif
- runTestNoPropDispatch<E>(M, dref, &dref.object.object);
- }
+ runTestNoPropDispatch<E>(M, dref, &dref.object.object);
}
-
- template <class Expect, class Fn, class T>
- void runTestDispatch(Fn M, T& obj, ObjectType* expect) {
- runTest<Expect &> (M, C_<T&>(obj), expect);
- runTest<Expect const&> (M, C_<T const&>(obj), expect);
- runTest<Expect volatile&> (M, C_<T volatile&>(obj), expect);
- runTest<Expect const volatile&>(M, C_<T const volatile&>(obj), expect);
+ }
+
+ template <class Expect, class Fn, class T>
+ void runTestDispatch(Fn M, T& obj, ObjectType* expect) {
+ runTest<Expect&>(M, C_<T&>(obj), expect);
+ runTest<Expect const&>(M, C_<T const&>(obj), expect);
+ runTest<Expect volatile&>(M, C_<T volatile&>(obj), expect);
+ runTest<Expect const volatile&>(M, C_<T const volatile&>(obj), expect);
#if TEST_STD_VER >= 11
- runTest<Expect&&> (M, C_<T&&>(obj), expect);
- runTest<Expect const&&> (M, C_<T const&&>(obj), expect);
- runTest<Expect volatile&&> (M, C_<T volatile&&>(obj), expect);
- runTest<Expect const volatile&&>(M, C_<T const volatile&&>(obj), expect);
+ runTest<Expect&&>(M, C_<T&&>(obj), expect);
+ runTest<Expect const&&>(M, C_<T const&&>(obj), expect);
+ runTest<Expect volatile&&>(M, C_<T volatile&&>(obj), expect);
+ runTest<Expect const volatile&&>(M, C_<T const volatile&&>(obj), expect);
#endif
- }
-
- template <class Expect, class Fn, class T>
- void runTestPropCVDispatch(Fn M, T& obj, ObjectType* expect) {
- runTest<Expect &> (M, obj, expect);
- runTest<Expect const&> (M, makeConst(obj), expect);
- runTest<Expect volatile&> (M, makeVolatile(obj), expect);
- runTest<Expect const volatile&>(M, makeCV(obj), expect);
- }
-
- template <class Expect, class Fn, class T>
- void runTestNoPropDispatch(Fn M, T& obj, ObjectType* expect) {
- runTest<Expect&>(M, C_<T &>(obj), expect);
- runTest<Expect&>(M, C_<T const&>(obj), expect);
- runTest<Expect&>(M, C_<T volatile&>(obj), expect);
- runTest<Expect&>(M, C_<T const volatile&>(obj), expect);
+ }
+
+ template <class Expect, class Fn, class T>
+ void runTestPropCVDispatch(Fn M, T& obj, ObjectType* expect) {
+ runTest<Expect&>(M, obj, expect);
+ runTest<Expect const&>(M, makeConst(obj), expect);
+ runTest<Expect volatile&>(M, makeVolatile(obj), expect);
+ runTest<Expect const volatile&>(M, makeCV(obj), expect);
+ }
+
+ template <class Expect, class Fn, class T>
+ void runTestNoPropDispatch(Fn M, T& obj, ObjectType* expect) {
+ runTest<Expect&>(M, C_<T&>(obj), expect);
+ runTest<Expect&>(M, C_<T const&>(obj), expect);
+ runTest<Expect&>(M, C_<T volatile&>(obj), expect);
+ runTest<Expect&>(M, C_<T const volatile&>(obj), expect);
#if TEST_STD_VER >= 11
- runTest<Expect&>(M, C_<T&&>(obj), expect);
- runTest<Expect&>(M, C_<T const&&>(obj), expect);
- runTest<Expect&>(M, C_<T volatile&&>(obj), expect);
- runTest<Expect&>(M, C_<T const volatile&&>(obj), expect);
+ runTest<Expect&>(M, C_<T&&>(obj), expect);
+ runTest<Expect&>(M, C_<T const&&>(obj), expect);
+ runTest<Expect&>(M, C_<T volatile&&>(obj), expect);
+ runTest<Expect&>(M, C_<T const volatile&&>(obj), expect);
#endif
- }
+ }
- template <class Expect, class Fn, class T>
- void runTest(Fn M, const T& obj, ObjectType* expect) {
- static_assert((std::is_same<
- decltype(std::__invoke(M, obj)), Expect
- >::value), "");
- Expect e = std::__invoke(M, obj);
- assert(&e == expect);
- }
+ template <class Expect, class Fn, class T>
+ void runTest(Fn M, const T& obj, ObjectType* expect) {
+ static_assert((std::is_same< decltype(std::__invoke(M, obj)), Expect >::value), "");
+ Expect e = std::__invoke(M, obj);
+ assert(&e == expect);
+ }
- template <class Expect, class Fn, class T>
+ template <class Expect, class Fn, class T>
#if TEST_STD_VER >= 11
- void runTest(Fn M, T&& obj, ObjectType* expect) {
+ void runTest(Fn M, T&& obj, ObjectType* expect){
#else
- void runTest(Fn M, T& obj, ObjectType* expect ) {
+ void runTest(Fn M, T& obj, ObjectType* expect) {
#endif
- {
- static_assert((std::is_same<
- decltype(std::__invoke(M, std::forward<T>(obj))), Expect
- >::value), "");
- Expect e = std::__invoke(M, std::forward<T>(obj));
- assert(&e == expect);
- }
- }
-};
+ {static_assert((std::is_same< decltype(std::__invoke(M, std::forward<T>(obj))), Expect >::value), "");
+ Expect e = std::__invoke(M, std::forward<T>(obj));
+ assert(&e == expect);
+}
+}
+}
+;
int main(int, char**) {
- TestCase<ArgType>::run();
- TestCase<ArgType const>::run();
- TestCase<ArgType volatile>::run();
- TestCase<ArgType const volatile>::run();
- TestCase<ArgType*>::run();
+ TestCase<ArgType>::run();
+ TestCase<ArgType const>::run();
+ TestCase<ArgType volatile>::run();
+ TestCase<ArgType const volatile>::run();
+ TestCase<ArgType*>::run();
return 0;
}
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_7.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_7.pass.cpp
index fb789fa0a..f1e7d10aa 100644
--- a/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_7.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/function.objects/func.require/bullet_7.pass.cpp
@@ -39,8 +39,6 @@
// 'f' has been called using 'FunctionID::checkCall()' if 'f' is a free
// function and 'MethodID::checkCall()' otherwise.
-
-
#include <functional>
#include <type_traits>
#include <cassert>
@@ -48,116 +46,113 @@
#include "test_macros.h"
#include "invoke_helpers.h"
-
//==============================================================================
// freeFunction03 - A C++03 free function.
-void*& freeFunction03() {
- return FunctionPtrID<void*&(), freeFunction03>::setUncheckedCall();
-}
+void*& freeFunction03() { return FunctionPtrID<void*&(), freeFunction03>::setUncheckedCall(); }
-void*& freeFunction03(...) {
- return FunctionPtrID<void*&(...), freeFunction03>::setUncheckedCall();
-}
+void*& freeFunction03(...) { return FunctionPtrID<void*&(...), freeFunction03>::setUncheckedCall(); }
template <class A0>
void*& freeFunction03(A0&) {
- return FunctionPtrID<void*&(A0&), freeFunction03>::setUncheckedCall();
+ return FunctionPtrID<void*&(A0&), freeFunction03>::setUncheckedCall();
}
-
template <class A0>
void*& freeFunction03(A0&, ...) {
- return FunctionPtrID<void*&(A0&, ...), freeFunction03>::setUncheckedCall();
+ return FunctionPtrID<void*&(A0&, ...), freeFunction03>::setUncheckedCall();
}
template <class A0, class A1>
void*& freeFunction03(A0&, A1&) {
- return FunctionPtrID<void*&(A0&, A1&), freeFunction03>::setUncheckedCall();
+ return FunctionPtrID<void*&(A0&, A1&), freeFunction03>::setUncheckedCall();
}
-
template <class A0, class A1>
void*& freeFunction03(A0&, A1&, ...) {
- return FunctionPtrID<void*&(A0&, A1&, ...), freeFunction03>::setUncheckedCall();
+ return FunctionPtrID<void*&(A0&, A1&, ...), freeFunction03>::setUncheckedCall();
}
template <class A0, class A1, class A2>
void*& freeFunction03(A0&, A1&, A2&) {
- return FunctionPtrID<void*&(A0&, A1&, A2&), freeFunction03>::setUncheckedCall();
+ return FunctionPtrID<void*&(A0&, A1&, A2&), freeFunction03>::setUncheckedCall();
}
template <class A0, class A1, class A2>
void*& freeFunction03(A0&, A1&, A2&, ...) {
- return FunctionPtrID<void*&(A0&, A1&, A2&, ...), freeFunction03>::setUncheckedCall();
+ return FunctionPtrID<void*&(A0&, A1&, A2&, ...), freeFunction03>::setUncheckedCall();
}
//==============================================================================
// Functor03 - C++03 compatible functor object
struct Functor03 {
- typedef void*& R;
- typedef Functor03 C;
-#define F(Args, ...) \
- __VA_ARGS__ R operator() Args { return MethodID<R(C::*) Args>::setUncheckedCall(); } \
- __VA_ARGS__ R operator() Args const { return MethodID<R(C::*) Args const>::setUncheckedCall(); } \
- __VA_ARGS__ R operator() Args volatile { return MethodID<R(C::*) Args volatile>::setUncheckedCall(); } \
- __VA_ARGS__ R operator() Args const volatile { return MethodID<R(C::*) Args const volatile>::setUncheckedCall(); }
+ typedef void*& R;
+ typedef Functor03 C;
+#define F(Args, ...) \
+ __VA_ARGS__ R operator() Args { return MethodID<R(C::*) Args>::setUncheckedCall(); } \
+ __VA_ARGS__ R operator() Args const { return MethodID<R(C::*) Args const>::setUncheckedCall(); } \
+ __VA_ARGS__ R operator() Args volatile { return MethodID<R(C::*) Args volatile>::setUncheckedCall(); } \
+ __VA_ARGS__ R operator() Args const volatile { return MethodID<R(C::*) Args const volatile>::setUncheckedCall(); }
#
- F(())
- F((A0&), template <class A0>)
- F((A0&, A1&), template <class A0, class A1>)
- F((A0&, A1&, A2&), template <class A0, class A1, class A2>)
+ F(())
+ F((A0&), template <class A0>)
+ F((A0&, A1&), template <class A0, class A1>)
+ F((A0&, A1&, A2&), template <class A0, class A1, class A2>)
#undef F
+
public:
- Functor03() {}
+ Functor03() {}
+
private:
- Functor03(Functor03 const&);
- Functor03& operator=(Functor03 const&);
+ Functor03(Functor03 const&);
+ Functor03& operator=(Functor03 const&);
};
-
#if TEST_STD_VER >= 11
//==============================================================================
// freeFunction11 - A C++11 free function.
-template <class ...Args>
+template <class... Args>
void*& freeFunction11(Args&&...) {
- return FunctionPtrID<void*&(Args&&...), freeFunction11>::setUncheckedCall();
+ return FunctionPtrID<void*&(Args && ...), freeFunction11>::setUncheckedCall();
}
-template <class ...Args>
-void*& freeFunction11(Args&&...,...) {
- return FunctionPtrID<void*&(Args&&...,...), freeFunction11>::setUncheckedCall();
+template <class... Args>
+void*& freeFunction11(Args&&..., ...) {
+ return FunctionPtrID<void*&(Args && ..., ...), freeFunction11>::setUncheckedCall();
}
//==============================================================================
// Functor11 - C++11 reference qualified test member functions.
struct Functor11 {
- typedef void*& R;
- typedef Functor11 C;
+ typedef void*& R;
+ typedef Functor11 C;
-#define F(CV) \
- template <class ...Args> \
- R operator()(Args&&...) CV { return MethodID<R(C::*)(Args&&...) CV>::setUncheckedCall(); }
+# define F(CV) \
+ template <class... Args> \
+ R operator()(Args&&...) CV { \
+ return MethodID<R (C::*)(Args && ...) CV>::setUncheckedCall(); \
+ }
#
- F(&)
- F(const &)
- F(volatile &)
- F(const volatile &)
- F(&&)
- F(const &&)
- F(volatile &&)
- F(const volatile &&)
-#undef F
+ F(&)
+ F(const&)
+ F(volatile&)
+ F(const volatile&)
+ F(&&)
+ F(const&&)
+ F(volatile&&)
+ F(const volatile&&)
+# undef F
+
public:
- Functor11() {}
+ Functor11() {}
+
private:
- Functor11(Functor11 const&);
- Functor11& operator=(Functor11 const&);
+ Functor11(Functor11 const&);
+ Functor11& operator=(Functor11 const&);
};
#endif // TEST_STD_VER >= 11
-
//==============================================================================
// TestCaseFunctorImp - A test case for an operator() class method.
// ClassType - The type of the call object.
@@ -165,20 +160,19 @@ private:
// Arity - the arity of 'CallSig'
// ObjCaster - Transformation function applied to call object.
// ArgCaster - Transformation function applied to the extra arguments.
-template <class ClassType, class CallSig, int Arity,
- class ObjCaster, class ArgCaster = LValueCaster>
+template <class ClassType, class CallSig, int Arity, class ObjCaster, class ArgCaster = LValueCaster>
struct TestCaseFunctorImp {
public:
- static void run() {
- typedef MethodID<CallSig ClassType::*> MID;
- BasicTest<MID, Arity, ObjCaster, ArgCaster> t;
- typedef ClassType T;
- typedef DerivedFromType<T> D;
- T obj;
- D der;
- t.runTest(obj);
- t.runTest(der);
- }
+ static void run() {
+ typedef MethodID<CallSig ClassType::*> MID;
+ BasicTest<MID, Arity, ObjCaster, ArgCaster> t;
+ typedef ClassType T;
+ typedef DerivedFromType<T> D;
+ T obj;
+ D der;
+ t.runTest(obj);
+ t.runTest(der);
+ }
};
//==============================================================================
@@ -190,18 +184,18 @@ public:
template <class CallSig, CallSig* FnPtr, int Arity, class ArgCaster>
struct TestCaseFreeFunction {
public:
- static void run() {
- typedef FunctionPtrID<CallSig, FnPtr> FID;
- BasicTest<FID, Arity, LValueCaster, ArgCaster> t;
-
- DerefToType<CallSig*> deref_to(FnPtr);
- DerefToType<CallSig&> deref_to_ref(*FnPtr);
-
- t.runTest(FnPtr);
- t.runTest(*FnPtr);
- t.runTest(deref_to);
- t.runTest(deref_to_ref);
- }
+ static void run() {
+ typedef FunctionPtrID<CallSig, FnPtr> FID;
+ BasicTest<FID, Arity, LValueCaster, ArgCaster> t;
+
+ DerefToType<CallSig*> deref_to(FnPtr);
+ DerefToType<CallSig&> deref_to_ref(*FnPtr);
+
+ t.runTest(FnPtr);
+ t.runTest(*FnPtr);
+ t.runTest(deref_to);
+ t.runTest(deref_to_ref);
+ }
};
//==============================================================================
@@ -210,118 +204,118 @@ public:
#if TEST_STD_VER >= 11
template <class Sig, int Arity, class ArgCaster>
void runFunctionTestCase11() {
- TestCaseFreeFunction<Sig, freeFunction11, Arity, ArgCaster>();
+ TestCaseFreeFunction<Sig, freeFunction11, Arity, ArgCaster>();
}
#endif
template <class Sig, int Arity, class ArgCaster>
void runFunctionTestCase() {
- TestCaseFreeFunction<Sig, freeFunction03, Arity, ArgCaster>();
+ TestCaseFreeFunction<Sig, freeFunction03, Arity, ArgCaster>();
#if TEST_STD_VER >= 11
- runFunctionTestCase11<Sig, Arity, ArgCaster>();
+ runFunctionTestCase11<Sig, Arity, ArgCaster>();
#endif
}
template <class Sig, int Arity, class ObjCaster, class ArgCaster>
void runFunctorTestCase() {
- TestCaseFunctorImp<Functor03, Sig, Arity, ObjCaster, ArgCaster>::run();
+ TestCaseFunctorImp<Functor03, Sig, Arity, ObjCaster, ArgCaster>::run();
}
template <class Sig, int Arity, class ObjCaster>
void runFunctorTestCase() {
- TestCaseFunctorImp<Functor03, Sig, Arity, ObjCaster>::run();
+ TestCaseFunctorImp<Functor03, Sig, Arity, ObjCaster>::run();
}
#if TEST_STD_VER >= 11
// runTestCase - Run a test case for C++11 class functor types
template <class Sig, int Arity, class ObjCaster, class ArgCaster = LValueCaster>
void runFunctorTestCase11() {
- TestCaseFunctorImp<Functor11, Sig, Arity, ObjCaster, ArgCaster>::run();
+ TestCaseFunctorImp<Functor11, Sig, Arity, ObjCaster, ArgCaster>::run();
}
#endif
// runTestCase - Run a test case for both function and functor types.
template <class Sig, int Arity, class ArgCaster>
void runTestCase() {
- runFunctionTestCase<Sig, Arity, ArgCaster>();
- runFunctorTestCase <Sig, Arity, LValueCaster, ArgCaster>();
+ runFunctionTestCase<Sig, Arity, ArgCaster>();
+ runFunctorTestCase<Sig, Arity, LValueCaster, ArgCaster>();
};
int main(int, char**) {
- typedef void*& R;
- typedef ArgType A;
- typedef A const CA;
-
- runTestCase< R(), 0, LValueCaster >();
- runTestCase< R(A&), 1, LValueCaster >();
- runTestCase< R(A&, A&), 2, LValueCaster >();
- runTestCase< R(A&, A&, A&), 3, LValueCaster >();
- runTestCase< R(CA&), 1, ConstCaster >();
- runTestCase< R(CA&, CA&), 2, ConstCaster >();
- runTestCase< R(CA&, CA&, CA&), 3, ConstCaster >();
-
- runFunctionTestCase<R(...), 0, LValueCaster >();
- runFunctionTestCase<R(A&, ...), 1, LValueCaster >();
- runFunctionTestCase<R(A&, A&, ...), 2, LValueCaster >();
- runFunctionTestCase<R(A&, A&, A&, ...), 3, LValueCaster >();
+ typedef void*& R;
+ typedef ArgType A;
+ typedef A const CA;
+
+ runTestCase< R(), 0, LValueCaster >();
+ runTestCase< R(A&), 1, LValueCaster >();
+ runTestCase< R(A&, A&), 2, LValueCaster >();
+ runTestCase< R(A&, A&, A&), 3, LValueCaster >();
+ runTestCase< R(CA&), 1, ConstCaster >();
+ runTestCase< R(CA&, CA&), 2, ConstCaster >();
+ runTestCase< R(CA&, CA&, CA&), 3, ConstCaster >();
+
+ runFunctionTestCase<R(...), 0, LValueCaster >();
+ runFunctionTestCase<R(A&, ...), 1, LValueCaster >();
+ runFunctionTestCase<R(A&, A&, ...), 2, LValueCaster >();
+ runFunctionTestCase<R(A&, A&, A&, ...), 3, LValueCaster >();
#if TEST_STD_VER >= 11
- runFunctionTestCase11<R(A&&), 1, MoveCaster >();
- runFunctionTestCase11<R(A&&, ...), 1, MoveCaster >();
+ runFunctionTestCase11<R(A&&), 1, MoveCaster >();
+ runFunctionTestCase11<R(A&&, ...), 1, MoveCaster >();
#endif
- runFunctorTestCase<R(), 0, LValueCaster >();
- runFunctorTestCase<R() const, 0, ConstCaster >();
- runFunctorTestCase<R() volatile, 0, VolatileCaster >();
- runFunctorTestCase<R() const volatile, 0, CVCaster >();
- runFunctorTestCase<R(A&), 1, LValueCaster >();
- runFunctorTestCase<R(A&) const, 1, ConstCaster >();
- runFunctorTestCase<R(A&) volatile, 1, VolatileCaster >();
- runFunctorTestCase<R(A&) const volatile, 1, CVCaster >();
- runFunctorTestCase<R(A&, A&), 2, LValueCaster >();
- runFunctorTestCase<R(A&, A&) const, 2, ConstCaster >();
- runFunctorTestCase<R(A&, A&) volatile, 2, VolatileCaster >();
- runFunctorTestCase<R(A&, A&) const volatile, 2, CVCaster >();
- runFunctorTestCase<R(A&, A&, A&), 3, LValueCaster >();
- runFunctorTestCase<R(A&, A&, A&) const, 3, ConstCaster >();
- runFunctorTestCase<R(A&, A&, A&) volatile, 3, VolatileCaster >();
- runFunctorTestCase<R(A&, A&, A&) const volatile, 3, CVCaster >();
- {
+ runFunctorTestCase<R(), 0, LValueCaster >();
+ runFunctorTestCase<R() const, 0, ConstCaster >();
+ runFunctorTestCase<R() volatile, 0, VolatileCaster >();
+ runFunctorTestCase<R() const volatile, 0, CVCaster >();
+ runFunctorTestCase<R(A&), 1, LValueCaster >();
+ runFunctorTestCase<R(A&) const, 1, ConstCaster >();
+ runFunctorTestCase<R(A&) volatile, 1, VolatileCaster >();
+ runFunctorTestCase<R(A&) const volatile, 1, CVCaster >();
+ runFunctorTestCase<R(A&, A&), 2, LValueCaster >();
+ runFunctorTestCase<R(A&, A&) const, 2, ConstCaster >();
+ runFunctorTestCase<R(A&, A&) volatile, 2, VolatileCaster >();
+ runFunctorTestCase<R(A&, A&) const volatile, 2, CVCaster >();
+ runFunctorTestCase<R(A&, A&, A&), 3, LValueCaster >();
+ runFunctorTestCase<R(A&, A&, A&) const, 3, ConstCaster >();
+ runFunctorTestCase<R(A&, A&, A&) volatile, 3, VolatileCaster >();
+ runFunctorTestCase<R(A&, A&, A&) const volatile, 3, CVCaster >();
+ {
typedef ConstCaster CC;
- runFunctorTestCase<R(CA&), 1, LValueCaster, CC>();
- runFunctorTestCase<R(CA&) const, 1, ConstCaster, CC>();
- runFunctorTestCase<R(CA&) volatile, 1, VolatileCaster, CC>();
- runFunctorTestCase<R(CA&) const volatile, 1, CVCaster, CC>();
- runFunctorTestCase<R(CA&, CA&), 2, LValueCaster, CC>();
- runFunctorTestCase<R(CA&, CA&) const, 2, ConstCaster, CC>();
- runFunctorTestCase<R(CA&, CA&) volatile, 2, VolatileCaster, CC>();
- runFunctorTestCase<R(CA&, CA&) const volatile, 2, CVCaster, CC>();
- runFunctorTestCase<R(CA&, CA&, CA&), 3, LValueCaster, CC>();
- runFunctorTestCase<R(CA&, CA&, CA&) const, 3, ConstCaster, CC>();
- runFunctorTestCase<R(CA&, CA&, CA&) volatile, 3, VolatileCaster, CC>();
- runFunctorTestCase<R(CA&, CA&, CA&) const volatile, 3, CVCaster, CC>();
- }
+ runFunctorTestCase<R(CA&), 1, LValueCaster, CC>();
+ runFunctorTestCase<R(CA&) const, 1, ConstCaster, CC>();
+ runFunctorTestCase<R(CA&) volatile, 1, VolatileCaster, CC>();
+ runFunctorTestCase<R(CA&) const volatile, 1, CVCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&), 2, LValueCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&) const, 2, ConstCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&) volatile, 2, VolatileCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&) const volatile, 2, CVCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&), 3, LValueCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&) const, 3, ConstCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&) volatile, 3, VolatileCaster, CC>();
+ runFunctorTestCase<R(CA&, CA&, CA&) const volatile, 3, CVCaster, CC>();
+ }
#if TEST_STD_VER >= 11
- runFunctorTestCase11<R() &, 0, LValueCaster >();
- runFunctorTestCase11<R() const &, 0, ConstCaster >();
- runFunctorTestCase11<R() volatile &, 0, VolatileCaster >();
- runFunctorTestCase11<R() const volatile &, 0, CVCaster >();
- runFunctorTestCase11<R() &&, 0, MoveCaster >();
- runFunctorTestCase11<R() const &&, 0, MoveConstCaster >();
- runFunctorTestCase11<R() volatile &&, 0, MoveVolatileCaster >();
- runFunctorTestCase11<R() const volatile &&, 0, MoveCVCaster >();
- {
+ runFunctorTestCase11<R() &, 0, LValueCaster >();
+ runFunctorTestCase11<R() const&, 0, ConstCaster >();
+ runFunctorTestCase11<R() volatile&, 0, VolatileCaster >();
+ runFunctorTestCase11<R() const volatile&, 0, CVCaster >();
+ runFunctorTestCase11<R() &&, 0, MoveCaster >();
+ runFunctorTestCase11<R() const&&, 0, MoveConstCaster >();
+ runFunctorTestCase11<R() volatile&&, 0, MoveVolatileCaster >();
+ runFunctorTestCase11<R() const volatile&&, 0, MoveCVCaster >();
+ {
typedef MoveCaster MC;
- runFunctorTestCase11<R(A&&) &, 1, LValueCaster, MC>();
- runFunctorTestCase11<R(A&&) const &, 1, ConstCaster, MC>();
- runFunctorTestCase11<R(A&&) volatile &, 1, VolatileCaster, MC>();
- runFunctorTestCase11<R(A&&) const volatile &, 1, CVCaster, MC>();
- runFunctorTestCase11<R(A&&) &&, 1, MoveCaster, MC>();
- runFunctorTestCase11<R(A&&) const &&, 1, MoveConstCaster, MC>();
- runFunctorTestCase11<R(A&&) volatile &&, 1, MoveVolatileCaster, MC>();
- runFunctorTestCase11<R(A&&) const volatile &&, 1, MoveCVCaster, MC>();
- }
+ runFunctorTestCase11<R(A&&) &, 1, LValueCaster, MC>();
+ runFunctorTestCase11<R(A&&) const&, 1, ConstCaster, MC>();
+ runFunctorTestCase11<R(A&&) volatile&, 1, VolatileCaster, MC>();
+ runFunctorTestCase11<R(A&&) const volatile&, 1, CVCaster, MC>();
+ runFunctorTestCase11<R(A&&) &&, 1, MoveCaster, MC>();
+ runFunctorTestCase11<R(A&&) const&&, 1, MoveConstCaster, MC>();
+ runFunctorTestCase11<R(A&&) volatile&&, 1, MoveVolatileCaster, MC>();
+ runFunctorTestCase11<R(A&&) const volatile&&, 1, MoveCVCaster, MC>();
+ }
#endif
return 0;
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke.pass.cpp
index e534553a8..78349ae78 100644
--- a/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke.pass.cpp
@@ -14,32 +14,29 @@
#include "test_macros.h"
template <typename T, int N>
-struct Array
-{
- typedef T type[N];
+struct Array {
+ typedef T type[N];
};
-struct Type
-{
- Array<char, 1>::type& f1();
- Array<char, 2>::type& f2() const;
+struct Type {
+ Array<char, 1>::type& f1();
+ Array<char, 2>::type& f2() const;
#if TEST_STD_VER >= 11
- Array<char, 1>::type& g1() &;
- Array<char, 2>::type& g2() const &;
- Array<char, 3>::type& g3() &&;
- Array<char, 4>::type& g4() const &&;
+ Array<char, 1>::type& g1() &;
+ Array<char, 2>::type& g2() const&;
+ Array<char, 3>::type& g3() &&;
+ Array<char, 4>::type& g4() const&&;
#endif
};
-int main(int, char**)
-{
- static_assert(sizeof(std::__invoke(&Type::f1, std::declval<Type >())) == 1, "");
- static_assert(sizeof(std::__invoke(&Type::f2, std::declval<Type const >())) == 2, "");
+int main(int, char**) {
+ static_assert(sizeof(std::__invoke(&Type::f1, std::declval<Type >())) == 1, "");
+ static_assert(sizeof(std::__invoke(&Type::f2, std::declval<Type const >())) == 2, "");
#if TEST_STD_VER >= 11
- static_assert(sizeof(std::__invoke(&Type::g1, std::declval<Type &>())) == 1, "");
- static_assert(sizeof(std::__invoke(&Type::g2, std::declval<Type const &>())) == 2, "");
- static_assert(sizeof(std::__invoke(&Type::g3, std::declval<Type &&>())) == 3, "");
- static_assert(sizeof(std::__invoke(&Type::g4, std::declval<Type const&&>())) == 4, "");
+ static_assert(sizeof(std::__invoke(&Type::g1, std::declval<Type&>())) == 1, "");
+ static_assert(sizeof(std::__invoke(&Type::g2, std::declval<Type const&>())) == 2, "");
+ static_assert(sizeof(std::__invoke(&Type::g3, std::declval<Type&&>())) == 3, "");
+ static_assert(sizeof(std::__invoke(&Type::g4, std::declval<Type const&&>())) == 4, "");
#endif
return 0;
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke_helpers.h b/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke_helpers.h
index f6f418b51..e4b6de4d2 100644
--- a/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke_helpers.h
+++ b/libcxx/test/libcxx-03/utilities/function.objects/func.require/invoke_helpers.h
@@ -22,23 +22,31 @@ template <bool P>
struct Bool : public std::integral_constant<bool, P> {};
struct Q_None {
- template <class T>
- struct apply { typedef T type; };
+ template <class T>
+ struct apply {
+ typedef T type;
+ };
};
struct Q_Const {
- template <class T>
- struct apply { typedef T const type; };
+ template <class T>
+ struct apply {
+ typedef T const type;
+ };
};
struct Q_Volatile {
- template <class T>
- struct apply { typedef T volatile type; };
+ template <class T>
+ struct apply {
+ typedef T volatile type;
+ };
};
struct Q_CV {
- template <class T>
- struct apply { typedef T const volatile type; };
+ template <class T>
+ struct apply {
+ typedef T const volatile type;
+ };
};
// Caster - A functor object that performs cv-qualifier and value category
@@ -48,92 +56,103 @@ struct Q_CV {
// False otherwise.
template <class QualTag, bool RValue = false>
struct Caster {
- template <class T>
- struct apply {
- typedef typename std::remove_reference<T>::type RawType;
- typedef typename QualTag::template apply<RawType>::type CVType;
+ template <class T>
+ struct apply {
+ typedef typename std::remove_reference<T>::type RawType;
+ typedef typename QualTag::template apply<RawType>::type CVType;
#if TEST_STD_VER >= 11
- typedef typename std::conditional<RValue,
- CVType&&, CVType&
- >::type type;
+ typedef typename std::conditional<RValue, CVType&&, CVType& >::type type;
#else
- typedef CVType& type;
+ typedef CVType& type;
#endif
- };
+ };
- template <class T>
- typename apply<T>::type
- operator()(T& obj) const {
- typedef typename apply<T>::type OutType;
- return static_cast<OutType>(obj);
- }
+ template <class T>
+ typename apply<T>::type operator()(T& obj) const {
+ typedef typename apply<T>::type OutType;
+ return static_cast<OutType>(obj);
+ }
};
-typedef Caster<Q_None> LValueCaster;
-typedef Caster<Q_Const> ConstCaster;
-typedef Caster<Q_Volatile> VolatileCaster;
-typedef Caster<Q_CV> CVCaster;
-typedef Caster<Q_None, true> MoveCaster;
-typedef Caster<Q_Const, true> MoveConstCaster;
+typedef Caster<Q_None> LValueCaster;
+typedef Caster<Q_Const> ConstCaster;
+typedef Caster<Q_Volatile> VolatileCaster;
+typedef Caster<Q_CV> CVCaster;
+typedef Caster<Q_None, true> MoveCaster;
+typedef Caster<Q_Const, true> MoveConstCaster;
typedef Caster<Q_Volatile, true> MoveVolatileCaster;
-typedef Caster<Q_CV, true> MoveCVCaster;
-
+typedef Caster<Q_CV, true> MoveCVCaster;
template <class Tp>
-Tp const& makeConst(Tp& ref) { return ref; }
+Tp const& makeConst(Tp& ref) {
+ return ref;
+}
template <class Tp>
-Tp const* makeConst(Tp* ptr) { return ptr; }
+Tp const* makeConst(Tp* ptr) {
+ return ptr;
+}
template <class Tp>
std::reference_wrapper<const Tp> makeConst(std::reference_wrapper<Tp>& ref) {
- return std::reference_wrapper<const Tp>(ref.get());
+ return std::reference_wrapper<const Tp>(ref.get());
}
template <class Tp>
-Tp volatile& makeVolatile(Tp& ref) { return ref; }
+Tp volatile& makeVolatile(Tp& ref) {
+ return ref;
+}
template <class Tp>
-Tp volatile* makeVolatile(Tp* ptr) { return ptr; }
+Tp volatile* makeVolatile(Tp* ptr) {
+ return ptr;
+}
template <class Tp>
std::reference_wrapper<volatile Tp> makeVolatile(std::reference_wrapper<Tp>& ref) {
- return std::reference_wrapper<volatile Tp>(ref.get());
+ return std::reference_wrapper<volatile Tp>(ref.get());
}
template <class Tp>
-Tp const volatile& makeCV(Tp& ref) { return ref; }
+Tp const volatile& makeCV(Tp& ref) {
+ return ref;
+}
template <class Tp>
-Tp const volatile* makeCV(Tp* ptr) { return ptr; }
+Tp const volatile* makeCV(Tp* ptr) {
+ return ptr;
+}
template <class Tp>
std::reference_wrapper<const volatile Tp> makeCV(std::reference_wrapper<Tp>& ref) {
- return std::reference_wrapper<const volatile Tp>(ref.get());
+ return std::reference_wrapper<const volatile Tp>(ref.get());
}
// A shorter name for 'static_cast'
template <class QualType, class Tp>
-QualType C_(Tp& v) { return static_cast<QualType>(v); };
+QualType C_(Tp& v) {
+ return static_cast<QualType>(v);
+};
//==============================================================================
// ArgType - A non-copyable type intended to be used as a dummy argument type
// to test functions.
struct ArgType {
- int value;
- explicit ArgType(int val = 0) : value(val) {}
+ int value;
+ explicit ArgType(int val = 0) : value(val) {}
+
private:
- ArgType(ArgType const&);
- ArgType& operator=(ArgType const&);
+ ArgType(ArgType const&);
+ ArgType& operator=(ArgType const&);
};
//==============================================================================
// DerivedFromBase - A type that derives from its template argument 'Base'
template <class Base>
struct DerivedFromType : public Base {
- DerivedFromType() : Base() {}
- template <class Tp>
- explicit DerivedFromType(Tp const& t) : Base(t) {}
+ DerivedFromType() : Base() {}
+ template <class Tp>
+ explicit DerivedFromType(Tp const& t) : Base(t) {}
};
//==============================================================================
@@ -142,14 +161,14 @@ struct DerivedFromType : public Base {
// to the resulting 'To' object.
template <class To>
struct DerefToType {
- To object;
+ To object;
- DerefToType() {}
+ DerefToType() {}
- template <class Up>
- explicit DerefToType(Up const& val) : object(val) {}
+ template <class Up>
+ explicit DerefToType(Up const& val) : object(val) {}
- To& operator*() const volatile { return const_cast<To&>(object); }
+ To& operator*() const volatile { return const_cast<To&>(object); }
};
//==============================================================================
@@ -158,27 +177,27 @@ struct DerefToType {
// to the resulting 'To' object.
template <class To>
struct DerefPropType {
- To object;
+ To object;
- DerefPropType() {}
+ DerefPropType() {}
- template <class Up>
- explicit DerefPropType(Up const& val) : object(val) {}
+ template <class Up>
+ explicit DerefPropType(Up const& val) : object(val) {}
#if TEST_STD_VER < 11
- To& operator*() { return object; }
- To const& operator*() const { return object; }
- To volatile& operator*() volatile { return object; }
- To const volatile& operator*() const volatile { return object; }
+ To& operator*() { return object; }
+ To const& operator*() const { return object; }
+ To volatile& operator*() volatile { return object; }
+ To const volatile& operator*() const volatile { return object; }
#else
- To& operator*() & { return object; }
- To const& operator*() const & { return object; }
- To volatile& operator*() volatile & { return object; }
- To const volatile& operator*() const volatile & { return object; }
- To&& operator*() && { return static_cast<To &&>(object); }
- To const&& operator*() const && { return static_cast<To const&&>(object); }
- To volatile&& operator*() volatile && { return static_cast<To volatile&&>(object); }
- To const volatile&& operator*() const volatile && { return static_cast<To const volatile&&>(object); }
+ To& operator*() & { return object; }
+ To const& operator*() const& { return object; }
+ To volatile& operator*() volatile& { return object; }
+ To const volatile& operator*() const volatile& { return object; }
+ To&& operator*() && { return static_cast<To&&>(object); }
+ To const&& operator*() const&& { return static_cast<To const&&>(object); }
+ To volatile&& operator*() volatile&& { return static_cast<To volatile&&>(object); }
+ To const volatile&& operator*() const volatile&& { return static_cast<To const volatile&&>(object); }
#endif
};
@@ -192,54 +211,59 @@ struct DerefPropType {
// matches what the method actually returned.
template <class T>
struct MethodID {
- typedef void* IDType;
-
- static int dummy; // A dummy memory location.
- static void* id; // The "ID" is the value of this pointer.
- static bool unchecked_call; // Has a call happened that has not been checked.
-
- static void*& setUncheckedCall() {
- assert(unchecked_call == false);
- unchecked_call = true;
- return id;
- }
-
- static bool checkCalled(void*& return_value) {
- bool old = unchecked_call;
- unchecked_call = false;
- return old && id == return_value && &id == &return_value;
- }
+ typedef void* IDType;
+
+ static int dummy; // A dummy memory location.
+ static void* id; // The "ID" is the value of this pointer.
+ static bool unchecked_call; // Has a call happened that has not been checked.
+
+ static void*& setUncheckedCall() {
+ assert(unchecked_call == false);
+ unchecked_call = true;
+ return id;
+ }
+
+ static bool checkCalled(void*& return_value) {
+ bool old = unchecked_call;
+ unchecked_call = false;
+ return old && id == return_value && &id == &return_value;
+ }
};
-template <class T> int MethodID<T>::dummy = 0;
-template <class T> void* MethodID<T>::id = (void*)&MethodID<T>::dummy;
-template <class T> bool MethodID<T>::unchecked_call = false;
-
+template <class T>
+int MethodID<T>::dummy = 0;
+template <class T>
+void* MethodID<T>::id = (void*)&MethodID<T>::dummy;
+template <class T>
+bool MethodID<T>::unchecked_call = false;
//==============================================================================
// FunctionPtrID - Like MethodID but for free function pointers.
template <class T, T*>
struct FunctionPtrID {
- static int dummy; // A dummy memory location.
- static void* id; // The "ID" is the value of this pointer.
- static bool unchecked_call; // Has a call happened that has not been checked.
-
- static void*& setUncheckedCall() {
- assert(unchecked_call == false);
- unchecked_call = true;
- return id;
- }
-
- static bool checkCalled(void*& return_value) {
- bool old = unchecked_call;
- unchecked_call = false;
- return old && id == return_value && &id == &return_value;
- }
+ static int dummy; // A dummy memory location.
+ static void* id; // The "ID" is the value of this pointer.
+ static bool unchecked_call; // Has a call happened that has not been checked.
+
+ static void*& setUncheckedCall() {
+ assert(unchecked_call == false);
+ unchecked_call = true;
+ return id;
+ }
+
+ static bool checkCalled(void*& return_value) {
+ bool old = unchecked_call;
+ unchecked_call = false;
+ return old && id == return_value && &id == &return_value;
+ }
};
-template <class T, T* Ptr> int FunctionPtrID<T, Ptr>::dummy = 0;
-template <class T, T* Ptr> void* FunctionPtrID<T, Ptr>::id = (void*)&FunctionPtrID<T, Ptr>::dummy;
-template <class T, T* Ptr> bool FunctionPtrID<T, Ptr>::unchecked_call = false;
+template <class T, T* Ptr>
+int FunctionPtrID<T, Ptr>::dummy = 0;
+template <class T, T* Ptr>
+void* FunctionPtrID<T, Ptr>::id = (void*)&FunctionPtrID<T, Ptr>::dummy;
+template <class T, T* Ptr>
+bool FunctionPtrID<T, Ptr>::unchecked_call = false;
//==============================================================================
// BasicTest - The basic test structure for everything except
@@ -248,128 +272,122 @@ template <class T, T* Ptr> bool FunctionPtrID<T, Ptr>::unchecked_call = false;
// Arity - The Arity of the call signature.
// ObjectCaster - The object transformation functor type.
// ArgCaster - The extra argument transformation functor type.
-template <class ID, int Arity, class ObjectCaster = LValueCaster,
- class ArgCaster = LValueCaster>
+template <class ID, int Arity, class ObjectCaster = LValueCaster, class ArgCaster = LValueCaster>
struct BasicTest {
- template <class ObjectT>
- void runTest(ObjectT& object) {
- Int<Arity> A;
- runTestImp(A, object);
- }
-
- template <class MethodPtr, class ObjectT>
- void runTest(MethodPtr ptr, ObjectT& object) {
- Int<Arity> A;
- runTestImp(A, ptr, object);
- }
+ template <class ObjectT>
+ void runTest(ObjectT& object) {
+ Int<Arity> A;
+ runTestImp(A, object);
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTest(MethodPtr ptr, ObjectT& object) {
+ Int<Arity> A;
+ runTestImp(A, ptr, object);
+ }
private:
- typedef void*& CallRet;
- ObjectCaster object_cast;
- ArgCaster arg_cast;
- ArgType a0, a1, a2;
-
- //==========================================================================
- // BULLET 1, 2 AND 3 TEST METHODS
- //==========================================================================
- template <class MethodPtr, class ObjectT>
- void runTestImp(Int<0>, MethodPtr ptr, ObjectT& object) {
- {
- static_assert((std::is_same<
- decltype(std::__invoke(ptr, object_cast(object)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(ptr, object_cast(object));
- assert(ID::checkCalled(ret));
- }
+ typedef void*& CallRet;
+ ObjectCaster object_cast;
+ ArgCaster arg_cast;
+ ArgType a0, a1, a2;
+
+ //==========================================================================
+ // BULLET 1, 2 AND 3 TEST METHODS
+ //==========================================================================
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<0>, MethodPtr ptr, ObjectT& object) {
+ {
+ static_assert((std::is_same< decltype(std::__invoke(ptr, object_cast(object))), CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object));
+ assert(ID::checkCalled(ret));
}
-
- template <class MethodPtr, class ObjectT>
- void runTestImp(Int<1>, MethodPtr ptr, ObjectT& object) {
- {
- static_assert((std::is_same<
- decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0));
- assert(ID::checkCalled(ret));
- }
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<1>, MethodPtr ptr, ObjectT& object) {
+ {
+ static_assert(
+ (std::is_same< decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0))), CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0));
+ assert(ID::checkCalled(ret));
}
-
- template <class MethodPtr, class ObjectT>
- void runTestImp(Int<2>, MethodPtr ptr, ObjectT& object) {
- {
- static_assert((std::is_same<
- decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1));
- assert(ID::checkCalled(ret));
- }
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<2>, MethodPtr ptr, ObjectT& object) {
+ {
+ static_assert((std::is_same< decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1))),
+ CallRet>::value),
+ "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1));
+ assert(ID::checkCalled(ret));
}
-
- template <class MethodPtr, class ObjectT>
- void runTestImp(Int<3>, MethodPtr ptr, ObjectT& object) {
- {
- static_assert((std::is_same<
- decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
- assert(ID::checkCalled(ret));
- }
+ }
+
+ template <class MethodPtr, class ObjectT>
+ void runTestImp(Int<3>, MethodPtr ptr, ObjectT& object) {
+ {
+ static_assert(
+ (std::is_same< decltype(std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2))),
+ CallRet>::value),
+ "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(ptr, object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
+ assert(ID::checkCalled(ret));
}
-
- //==========================================================================
- // BULLET 7 TEST METHODS
- //==========================================================================
- template <class ObjectT>
- void runTestImp(Int<0>, ObjectT& object) {
- {
- static_assert((std::is_same<
- decltype(std::__invoke(object_cast(object)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(object_cast(object));
- assert(ID::checkCalled(ret));
- }
+ }
+
+ //==========================================================================
+ // BULLET 7 TEST METHODS
+ //==========================================================================
+ template <class ObjectT>
+ void runTestImp(Int<0>, ObjectT& object) {
+ {
+ static_assert((std::is_same< decltype(std::__invoke(object_cast(object))), CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object));
+ assert(ID::checkCalled(ret));
}
-
- template <class ObjectT>
- void runTestImp(Int<1>, ObjectT& object) {
- {
- static_assert((std::is_same<
- decltype(std::__invoke(object_cast(object), arg_cast(a0)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(object_cast(object), arg_cast(a0));
- assert(ID::checkCalled(ret));
- }
+ }
+
+ template <class ObjectT>
+ void runTestImp(Int<1>, ObjectT& object) {
+ {
+ static_assert((std::is_same< decltype(std::__invoke(object_cast(object), arg_cast(a0))), CallRet>::value), "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0));
+ assert(ID::checkCalled(ret));
}
-
- template <class ObjectT>
- void runTestImp(Int<2>, ObjectT& object) {
- {
- static_assert((std::is_same<
- decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1));
- assert(ID::checkCalled(ret));
- }
+ }
+
+ template <class ObjectT>
+ void runTestImp(Int<2>, ObjectT& object) {
+ {
+ static_assert(
+ (std::is_same< decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1))), CallRet>::value),
+ "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1));
+ assert(ID::checkCalled(ret));
}
-
- template <class ObjectT>
- void runTestImp(Int<3>, ObjectT& object) {
- {
- static_assert((std::is_same<
- decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2)))
- , CallRet>::value), "");
- assert(ID::unchecked_call == false);
- CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
- assert(ID::checkCalled(ret));
- }
+ }
+
+ template <class ObjectT>
+ void runTestImp(Int<3>, ObjectT& object) {
+ {
+ static_assert(
+ (std::is_same< decltype(std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2))),
+ CallRet>::value),
+ "");
+ assert(ID::unchecked_call == false);
+ CallRet ret = std::__invoke(object_cast(object), arg_cast(a0), arg_cast(a1), arg_cast(a2));
+ assert(ID::checkCalled(ret));
}
+ }
};
#endif // INVOKE_HELPERS_H
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.binary.compile.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.binary.compile.pass.cpp
index 023ed8ddb..6f84cb9ea 100644
--- a/libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.binary.compile.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/function.objects/refwrap/layout.binary.compile.pass.cpp
@@ -16,6 +16,8 @@ struct S1 : std::less<int>, std::greater<int> {};
static_assert(sizeof(S1) == 2, "");
-struct S2 : std::less<int> { char c; };
+struct S2 : std::less<int> {
+ char c;
+};
static_assert(sizeof(S2) == 1, "");
diff --git a/libcxx/test/libcxx-03/utilities/function.objects/unord.hash/murmur2_or_cityhash_ubsan_unsigned_overflow_ignored.pass.cpp b/libcxx/test/libcxx-03/utilities/function.objects/unord.hash/murmur2_or_cityhash_ubsan_unsigned_overflow_ignored.pass.cpp
index 11f0724f9..e98d6ec46 100644
--- a/libcxx/test/libcxx-03/utilities/function.objects/unord.hash/murmur2_or_cityhash_ubsan_unsigned_overflow_ignored.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/function.objects/unord.hash/murmur2_or_cityhash_ubsan_unsigned_overflow_ignored.pass.cpp
@@ -21,7 +21,7 @@ typedef std::__murmur2_or_cityhash<std::uint32_t> Hash32;
typedef std::__murmur2_or_cityhash<std::uint64_t> Hash64;
void test(const void* key, int len) {
- for (int i=1; i <= len; ++i) {
+ for (int i = 1; i <= len; ++i) {
Hash32 h1;
Hash64 h2;
DoNotOptimize(h1(key, i));
@@ -33,10 +33,9 @@ int main(int, char**) {
const std::string TestCases[] = {
"abcdaoeuaoeclaoeoaeuaoeuaousaotehu]+}sthoasuthaoesutahoesutaohesutaoeusaoetuhasoetuhaoseutaoseuthaoesutaohes",
"00000000000000000000000000000000000000000000000000000000000000000000000",
- "1237546895+54+4554985416849484213464984765465464654564565645645646546456546546"
- };
- const std::size_t NumCases = sizeof(TestCases)/sizeof(TestCases[0]);
- for (std::size_t i=0; i < NumCases; ++i)
+ "1237546895+54+4554985416849484213464984765465464654564565645645646546456546546"};
+ const std::size_t NumCases = sizeof(TestCases) / sizeof(TestCases[0]);
+ for (std::size_t i = 0; i < NumCases; ++i)
test(TestCases[i].data(), TestCases[i].length());
return 0;
diff --git a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address.pass.cpp b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address.pass.cpp
index 60ef98ae9..e319fcead 100644
--- a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address.pass.cpp
@@ -20,140 +20,143 @@
struct Irrelevant;
struct P1 {
- using element_type = Irrelevant;
- TEST_CONSTEXPR explicit P1(int *p) : p_(p) { }
- TEST_CONSTEXPR int *operator->() const { return p_; }
- int *p_;
+ using element_type = Irrelevant;
+ TEST_CONSTEXPR explicit P1(int* p) : p_(p) {}
+ TEST_CONSTEXPR int* operator->() const { return p_; }
+ int* p_;
};
struct P2 {
- using element_type = Irrelevant;
- TEST_CONSTEXPR explicit P2(int *p) : p_(p) { }
- TEST_CONSTEXPR P1 operator->() const { return p_; }
- P1 p_;
+ using element_type = Irrelevant;
+ TEST_CONSTEXPR explicit P2(int* p) : p_(p) {}
+ TEST_CONSTEXPR P1 operator->() const { return p_; }
+ P1 p_;
};
struct P3 {
- TEST_CONSTEXPR explicit P3(int *p) : p_(p) { }
- int *p_;
+ TEST_CONSTEXPR explicit P3(int* p) : p_(p) {}
+ int* p_;
};
-template<>
+template <>
struct std::pointer_traits<P3> {
- static TEST_CONSTEXPR int *to_address(const P3& p) { return p.p_; }
+ static TEST_CONSTEXPR int* to_address(const P3& p) { return p.p_; }
};
struct P4 {
- TEST_CONSTEXPR explicit P4(int *p) : p_(p) { }
- int *operator->() const; // should never be called
- int *p_;
+ TEST_CONSTEXPR explicit P4(int* p) : p_(p) {}
+ int* operator->() const; // should never be called
+ int* p_;
};
-template<>
+template <>
struct std::pointer_traits<P4> {
- static TEST_CONSTEXPR int *to_address(const P4& p) { return p.p_; }
+ static TEST_CONSTEXPR int* to_address(const P4& p) { return p.p_; }
};
struct P5 {
- using element_type = Irrelevant;
- int const* const& operator->() const;
+ using element_type = Irrelevant;
+ int const* const& operator->() const;
};
struct P6 {};
-template<>
+template <>
struct std::pointer_traits<P6> {
- static int const* const& to_address(const P6&);
+ static int const* const& to_address(const P6&);
};
// Taken from a build breakage caused in Clang
namespace P7 {
- template<typename T> struct CanProxy;
- template<typename T>
- struct CanQual {
- CanProxy<T> operator->() const { return CanProxy<T>(); }
- };
- template<typename T>
- struct CanProxy {
- const CanProxy<T> *operator->() const { return nullptr; }
- };
+template <typename T>
+struct CanProxy;
+template <typename T>
+struct CanQual {
+ CanProxy<T> operator->() const { return CanProxy<T>(); }
+};
+template <typename T>
+struct CanProxy {
+ const CanProxy<T>* operator->() const { return nullptr; }
+};
} // namespace P7
namespace P8 {
- template<class T>
- struct FancyPtrA {
- using element_type = Irrelevant;
- T *p_;
- TEST_CONSTEXPR FancyPtrA(T *p) : p_(p) {}
- T& operator*() const;
- TEST_CONSTEXPR T *operator->() const { return p_; }
- };
- template<class T>
- struct FancyPtrB {
- T *p_;
- TEST_CONSTEXPR FancyPtrB(T *p) : p_(p) {}
- T& operator*() const;
- };
+template <class T>
+struct FancyPtrA {
+ using element_type = Irrelevant;
+ T* p_;
+ TEST_CONSTEXPR FancyPtrA(T* p) : p_(p) {}
+ T& operator*() const;
+ TEST_CONSTEXPR T* operator->() const { return p_; }
+};
+template <class T>
+struct FancyPtrB {
+ T* p_;
+ TEST_CONSTEXPR FancyPtrB(T* p) : p_(p) {}
+ T& operator*() const;
+};
} // namespace P8
-template<class T>
+template <class T>
struct std::pointer_traits<P8::FancyPtrB<T> > {
- static TEST_CONSTEXPR T *to_address(const P8::FancyPtrB<T>& p) { return p.p_; }
+ static TEST_CONSTEXPR T* to_address(const P8::FancyPtrB<T>& p) { return p.p_; }
};
struct Incomplete;
-template<class T> struct Holder { T t; };
-
+template <class T>
+struct Holder {
+ T t;
+};
TEST_CONSTEXPR_CXX14 bool test() {
- int i = 0;
- ASSERT_NOEXCEPT(std::__to_address(&i));
- assert(std::__to_address(&i) == &i);
- P1 p1(&i);
- ASSERT_NOEXCEPT(std::__to_address(p1));
- assert(std::__to_address(p1) == &i);
- P2 p2(&i);
- ASSERT_NOEXCEPT(std::__to_address(p2));
- assert(std::__to_address(p2) == &i);
- P3 p3(&i);
- ASSERT_NOEXCEPT(std::__to_address(p3));
- assert(std::__to_address(p3) == &i);
- P4 p4(&i);
- ASSERT_NOEXCEPT(std::__to_address(p4));
- assert(std::__to_address(p4) == &i);
-
- ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval<int const*>())), int const*);
- ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval<P5>())), int const*);
- ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval<P6>())), int const*);
-
- P7::CanQual<int>* p7 = nullptr;
- assert(std::__to_address(p7) == nullptr);
- ASSERT_SAME_TYPE(decltype(std::__to_address(p7)), P7::CanQual<int>*);
-
- Holder<Incomplete> *p8_nil = nullptr; // for C++03 compatibility
- P8::FancyPtrA<Holder<Incomplete> > p8a = p8_nil;
- assert(std::__to_address(p8a) == p8_nil);
- ASSERT_SAME_TYPE(decltype(std::__to_address(p8a)), decltype(p8_nil));
-
- P8::FancyPtrB<Holder<Incomplete> > p8b = p8_nil;
- assert(std::__to_address(p8b) == p8_nil);
- ASSERT_SAME_TYPE(decltype(std::__to_address(p8b)), decltype(p8_nil));
-
- int p9[2] = {};
- assert(std::__to_address(p9) == p9);
- ASSERT_SAME_TYPE(decltype(std::__to_address(p9)), int*);
-
- const int p10[2] = {};
- assert(std::__to_address(p10) == p10);
- ASSERT_SAME_TYPE(decltype(std::__to_address(p10)), const int*);
-
- return true;
+ int i = 0;
+ ASSERT_NOEXCEPT(std::__to_address(&i));
+ assert(std::__to_address(&i) == &i);
+ P1 p1(&i);
+ ASSERT_NOEXCEPT(std::__to_address(p1));
+ assert(std::__to_address(p1) == &i);
+ P2 p2(&i);
+ ASSERT_NOEXCEPT(std::__to_address(p2));
+ assert(std::__to_address(p2) == &i);
+ P3 p3(&i);
+ ASSERT_NOEXCEPT(std::__to_address(p3));
+ assert(std::__to_address(p3) == &i);
+ P4 p4(&i);
+ ASSERT_NOEXCEPT(std::__to_address(p4));
+ assert(std::__to_address(p4) == &i);
+
+ ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval<int const*>())), int const*);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval<P5>())), int const*);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(std::declval<P6>())), int const*);
+
+ P7::CanQual<int>* p7 = nullptr;
+ assert(std::__to_address(p7) == nullptr);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(p7)), P7::CanQual<int>*);
+
+ Holder<Incomplete>* p8_nil = nullptr; // for C++03 compatibility
+ P8::FancyPtrA<Holder<Incomplete> > p8a = p8_nil;
+ assert(std::__to_address(p8a) == p8_nil);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(p8a)), decltype(p8_nil));
+
+ P8::FancyPtrB<Holder<Incomplete> > p8b = p8_nil;
+ assert(std::__to_address(p8b) == p8_nil);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(p8b)), decltype(p8_nil));
+
+ int p9[2] = {};
+ assert(std::__to_address(p9) == p9);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(p9)), int*);
+
+ const int p10[2] = {};
+ assert(std::__to_address(p10) == p10);
+ ASSERT_SAME_TYPE(decltype(std::__to_address(p10)), const int*);
+
+ return true;
}
int main(int, char**) {
- test();
+ test();
#if TEST_STD_VER >= 14
- static_assert(test(), "");
+ static_assert(test(), "");
#endif
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_funcptr.verify.cpp b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_funcptr.verify.cpp
index 02b167605..363172ef3 100644
--- a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_funcptr.verify.cpp
+++ b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_funcptr.verify.cpp
@@ -16,5 +16,5 @@
int (*pf)();
void test() {
- (void)std::__to_address(pf); // expected-error@*:* {{is a function type}}
+ (void)std::__to_address(pf); // expected-error@*:* {{is a function type}}
}
diff --git a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_function.verify.cpp b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_function.verify.cpp
index b8825a181..4f2d4c52a 100644
--- a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_function.verify.cpp
+++ b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_on_function.verify.cpp
@@ -16,5 +16,5 @@
int f();
void test() {
- (void)std::__to_address(f); // expected-error@*:* {{is a function type}}
+ (void)std::__to_address(f); // expected-error@*:* {{is a function type}}
}
diff --git a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_std_iterators.pass.cpp b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_std_iterators.pass.cpp
index 5eed12d19..6c4c4c8e8 100644
--- a/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_std_iterators.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/memory/pointer.conversion/to_address_std_iterators.pass.cpp
@@ -22,35 +22,33 @@
#include <vector>
#include "test_macros.h"
-template<class C>
-void test_container_iterators(C c)
-{
- const C& cc = c;
- assert(std::__to_address(c.begin()) == c.data());
- assert(std::__to_address(c.end()) == c.data() + c.size());
- assert(std::__to_address(cc.begin()) == cc.data());
- assert(std::__to_address(cc.end()) == cc.data() + cc.size());
+template <class C>
+void test_container_iterators(C c) {
+ const C& cc = c;
+ assert(std::__to_address(c.begin()) == c.data());
+ assert(std::__to_address(c.end()) == c.data() + c.size());
+ assert(std::__to_address(cc.begin()) == cc.data());
+ assert(std::__to_address(cc.end()) == cc.data() + cc.size());
}
-void test_valarray_iterators()
-{
- std::valarray<int> v(100);
- int *p = std::__to_address(std::begin(v));
- int *q = std::__to_address(std::end(v));
- assert(q - p == 100);
+void test_valarray_iterators() {
+ std::valarray<int> v(100);
+ int* p = std::__to_address(std::begin(v));
+ int* q = std::__to_address(std::end(v));
+ assert(q - p == 100);
}
int main(int, char**) {
- test_container_iterators(std::array<int, 3>());
- test_container_iterators(std::vector<int>(3));
- test_container_iterators(std::string("abc"));
+ test_container_iterators(std::array<int, 3>());
+ test_container_iterators(std::vector<int>(3));
+ test_container_iterators(std::string("abc"));
#if TEST_STD_VER >= 17
- test_container_iterators(std::string_view("abc"));
+ test_container_iterators(std::string_view("abc"));
#endif
#if TEST_STD_VER >= 20
- test_container_iterators(std::span<const char>("abc"));
+ test_container_iterators(std::span<const char>("abc"));
#endif
- test_valarray_iterators();
+ test_valarray_iterators();
- return 0;
+ return 0;
}
diff --git a/libcxx/test/libcxx-03/utilities/meta/meta_base.pass.cpp b/libcxx/test/libcxx-03/utilities/meta/meta_base.pass.cpp
index 66c25b1d7..df62c79d7 100644
--- a/libcxx/test/libcxx-03/utilities/meta/meta_base.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/meta/meta_base.pass.cpp
@@ -26,7 +26,7 @@ struct BOOM {
using Explode = typename T::BOOMBOOM;
};
-using True = std::true_type;
+using True = std::true_type;
using False = std::false_type;
void test_if() {
@@ -87,6 +87,4 @@ void test_is_valid_trait() {
static_assert(!std::_IsValidExpansion<FuncCallable, MemberTest, void*>::value, "");
}
-int main(int, char**) {
- return 0;
-}
+int main(int, char**) { return 0; }
diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
index 1f5dae123..7df3707b6 100644
--- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.non_trivial_copy_move.pass.cpp
@@ -28,127 +28,128 @@
#include "test_macros.h"
template <class T>
-struct HasNonTrivialABI : std::integral_constant<bool,
- !std::is_trivially_destructible<T>::value
- || (std::is_copy_constructible<T>::value && !std::is_trivially_copy_constructible<T>::value)
+struct HasNonTrivialABI
+ : std::integral_constant<
+ bool,
+ !std::is_trivially_destructible<T>::value ||
+ (std::is_copy_constructible<T>::value && !std::is_trivially_copy_constructible<T>::value)
#if TEST_STD_VER >= 11
- || (std::is_move_constructible<T>::value && !std::is_trivially_move_constructible<T>::value)
+ || (std::is_move_constructible<T>::value && !std::is_trivially_move_constructible<T>::value)
#endif
-> {};
+ > {
+};
#if TEST_STD_VER >= 11
struct NonTrivialDtor {
- NonTrivialDtor(NonTrivialDtor const&) = default;
- ~NonTrivialDtor();
+ NonTrivialDtor(NonTrivialDtor const&) = default;
+ ~NonTrivialDtor();
};
NonTrivialDtor::~NonTrivialDtor() {}
static_assert(HasNonTrivialABI<NonTrivialDtor>::value, "");
struct NonTrivialCopy {
- NonTrivialCopy(NonTrivialCopy const&);
+ NonTrivialCopy(NonTrivialCopy const&);
};
NonTrivialCopy::NonTrivialCopy(NonTrivialCopy const&) {}
static_assert(HasNonTrivialABI<NonTrivialCopy>::value, "");
struct NonTrivialMove {
- NonTrivialMove(NonTrivialMove const&) = default;
- NonTrivialMove(NonTrivialMove&&);
+ NonTrivialMove(NonTrivialMove const&) = default;
+ NonTrivialMove(NonTrivialMove&&);
};
NonTrivialMove::NonTrivialMove(NonTrivialMove&&) {}
static_assert(HasNonTrivialABI<NonTrivialMove>::value, "");
struct DeletedCopy {
- DeletedCopy(DeletedCopy const&) = delete;
- DeletedCopy(DeletedCopy&&) = default;
+ DeletedCopy(DeletedCopy const&) = delete;
+ DeletedCopy(DeletedCopy&&) = default;
};
static_assert(!HasNonTrivialABI<DeletedCopy>::value, "");
struct TrivialMove {
- TrivialMove(TrivialMove &&) = default;
+ TrivialMove(TrivialMove&&) = default;
};
static_assert(!HasNonTrivialABI<TrivialMove>::value, "");
struct Trivial {
- Trivial(Trivial const&) = default;
+ Trivial(Trivial const&) = default;
};
static_assert(!HasNonTrivialABI<Trivial>::value, "");
#endif
-
-void test_trivial()
-{
- {
- typedef std::pair<int, short> P;
- static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(HasNonTrivialABI<P>::value, "");
- }
+void test_trivial() {
+ {
+ typedef std::pair<int, short> P;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::pair<int, short> P;
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(HasNonTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<NonTrivialDtor, int>;
- static_assert(!std::is_trivially_destructible<P>::value, "");
- static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(!std::is_trivially_move_constructible<P>::value, "");
- static_assert(HasNonTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<NonTrivialCopy, int>;
- static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(!std::is_trivially_move_constructible<P>::value, "");
- static_assert(HasNonTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<NonTrivialMove, int>;
- static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(!std::is_trivially_move_constructible<P>::value, "");
- static_assert(HasNonTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<DeletedCopy, int>;
- static_assert(!std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(!std::is_trivially_move_constructible<P>::value, "");
- static_assert(HasNonTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<Trivial, int>;
- static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(!std::is_trivially_move_constructible<P>::value, "");
- static_assert(HasNonTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<TrivialMove, int>;
- static_assert(!std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(!std::is_trivially_move_constructible<P>::value, "");
- static_assert(HasNonTrivialABI<P>::value, "");
- }
+ {
+ typedef std::pair<int, short> P;
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialDtor, int>;
+ static_assert(!std::is_trivially_destructible<P>::value, "");
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialCopy, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialMove, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<DeletedCopy, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<Trivial, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<TrivialMove, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasNonTrivialABI<P>::value, "");
+ }
#endif
}
void test_layout() {
- typedef std::pair<std::pair<char, char>, char> PairT;
- static_assert(sizeof(PairT) == 3, "");
- static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), "");
- static_assert(offsetof(PairT, first) == 0, "");
+ typedef std::pair<std::pair<char, char>, char> PairT;
+ static_assert(sizeof(PairT) == 3, "");
+ static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), "");
+ static_assert(offsetof(PairT, first) == 0, "");
}
int main(int, char**) {
- test_trivial();
- test_layout();
- return 0;
+ test_trivial();
+ test_layout();
+ return 0;
}
diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp
index 3ec60c08b..2cd6cb7b0 100644
--- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp
+++ b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/abi.trivial_copy_move.pass.cpp
@@ -25,48 +25,51 @@
#include "test_macros.h"
template <class T>
-struct HasTrivialABI : std::integral_constant<bool,
- std::is_trivially_destructible<T>::value
- && (!std::is_copy_constructible<T>::value || std::is_trivially_copy_constructible<T>::value)
+struct HasTrivialABI
+ : std::integral_constant<
+ bool,
+ std::is_trivially_destructible<T>::value &&
+ (!std::is_copy_constructible<T>::value || std::is_trivially_copy_constructible<T>::value)
#if TEST_STD_VER >= 11
- && (!std::is_move_constructible<T>::value || std::is_trivially_move_constructible<T>::value)
+ && (!std::is_move_constructible<T>::value || std::is_trivially_move_constructible<T>::value)
#endif
-> {};
+ > {
+};
#if TEST_STD_VER >= 11
struct NonTrivialDtor {
- NonTrivialDtor(NonTrivialDtor const&) = default;
- ~NonTrivialDtor();
+ NonTrivialDtor(NonTrivialDtor const&) = default;
+ ~NonTrivialDtor();
};
NonTrivialDtor::~NonTrivialDtor() {}
static_assert(!HasTrivialABI<NonTrivialDtor>::value, "");
struct NonTrivialCopy {
- NonTrivialCopy(NonTrivialCopy const&);
+ NonTrivialCopy(NonTrivialCopy const&);
};
NonTrivialCopy::NonTrivialCopy(NonTrivialCopy const&) {}
static_assert(!HasTrivialABI<NonTrivialCopy>::value, "");
struct NonTrivialMove {
- NonTrivialMove(NonTrivialMove const&) = default;
- NonTrivialMove(NonTrivialMove&&);
+ NonTrivialMove(NonTrivialMove const&) = default;
+ NonTrivialMove(NonTrivialMove&&);
};
NonTrivialMove::NonTrivialMove(NonTrivialMove&&) {}
static_assert(!HasTrivialABI<NonTrivialMove>::value, "");
struct DeletedCopy {
- DeletedCopy(DeletedCopy const&) = delete;
- DeletedCopy(DeletedCopy&&) = default;
+ DeletedCopy(DeletedCopy const&) = delete;
+ DeletedCopy(DeletedCopy&&) = default;
};
static_assert(HasTrivialABI<DeletedCopy>::value, "");
struct TrivialMove {
- TrivialMove(TrivialMove &&) = default;
+ TrivialMove(TrivialMove&&) = default;
};
static_assert(HasTrivialABI<TrivialMove>::value, "");
struct Trivial {
- Trivial(Trivial const&) = default;
+ Trivial(Trivial const&) = default;
};
static_assert(HasTrivialABI<Trivial>::value, "");
#endif
@@ -83,100 +86,99 @@ struct TrivialNoConstruction {
TrivialNoConstruction& operator=(const TrivialNoConstruction&) = default;
};
-void test_trivial()
-{
- {
- typedef std::pair<int, short> P;
- static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(HasTrivialABI<P>::value, "");
- }
+void test_trivial() {
+ {
+ typedef std::pair<int, short> P;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
#if TEST_STD_VER >= 11
- {
- typedef std::pair<int, short> P;
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(HasTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<NonTrivialDtor, int>;
- static_assert(!std::is_trivially_destructible<P>::value, "");
- static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(!std::is_trivially_move_constructible<P>::value, "");
- static_assert(!HasTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<NonTrivialCopy, int>;
- static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(!std::is_trivially_move_constructible<P>::value, "");
- static_assert(!HasTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<NonTrivialMove, int>;
- static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(!std::is_trivially_move_constructible<P>::value, "");
- static_assert(!HasTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<DeletedCopy, int>;
- static_assert(!std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(std::is_trivially_move_constructible<P>::value, "");
- static_assert(HasTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<Trivial, int>;
- static_assert(std::is_copy_constructible<P>::value, "");
- static_assert(std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(std::is_trivially_move_constructible<P>::value, "");
- static_assert(HasTrivialABI<P>::value, "");
- }
- {
- using P = std::pair<TrivialMove, int>;
- static_assert(!std::is_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_move_constructible<P>::value, "");
- static_assert(std::is_trivially_move_constructible<P>::value, "");
- static_assert(HasTrivialABI<P>::value, "");
- }
+ {
+ typedef std::pair<int, short> P;
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialDtor, int>;
+ static_assert(!std::is_trivially_destructible<P>::value, "");
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialCopy, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<NonTrivialMove, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<DeletedCopy, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<Trivial, int>;
+ static_assert(std::is_copy_constructible<P>::value, "");
+ static_assert(std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
+ {
+ using P = std::pair<TrivialMove, int>;
+ static_assert(!std::is_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_move_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
+ static_assert(HasTrivialABI<P>::value, "");
+ }
#endif
- {
- using P = std::pair<TrivialNoAssignment, int>;
- static_assert(std::is_trivially_copy_constructible<P>::value, "");
- static_assert(std::is_trivially_move_constructible<P>::value, "");
+ {
+ using P = std::pair<TrivialNoAssignment, int>;
+ static_assert(std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(std::is_trivially_move_constructible<P>::value, "");
#if TEST_STD_VER >= 11 // This is https://llvm.org/PR90605
- static_assert(!std::is_trivially_copy_assignable<P>::value, "");
- static_assert(!std::is_trivially_move_assignable<P>::value, "");
+ static_assert(!std::is_trivially_copy_assignable<P>::value, "");
+ static_assert(!std::is_trivially_move_assignable<P>::value, "");
#endif // TEST_STD_VER >= 11
- static_assert(std::is_trivially_destructible<P>::value, "");
- }
- {
- using P = std::pair<TrivialNoConstruction, int>;
+ static_assert(std::is_trivially_destructible<P>::value, "");
+ }
+ {
+ using P = std::pair<TrivialNoConstruction, int>;
#if TEST_STD_VER >= 11
- static_assert(!std::is_trivially_copy_constructible<P>::value, "");
- static_assert(!std::is_trivially_move_constructible<P>::value, "");
+ static_assert(!std::is_trivially_copy_constructible<P>::value, "");
+ static_assert(!std::is_trivially_move_constructible<P>::value, "");
#endif // TEST_STD_VER >= 11
- static_assert(!std::is_trivially_copy_assignable<P>::value, "");
- static_assert(!std::is_trivially_move_assignable<P>::value, "");
- static_assert(std::is_trivially_destructible<P>::value, "");
- }
+ static_assert(!std::is_trivially_copy_assignable<P>::value, "");
+ static_assert(!std::is_trivially_move_assignable<P>::value, "");
+ static_assert(std::is_trivially_destructible<P>::value, "");
+ }
}
void test_layout() {
- typedef std::pair<std::pair<char, char>, char> PairT;
- static_assert(sizeof(PairT) == 3, "");
- static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), "");
- static_assert(offsetof(PairT, first) == 0, "");
+ typedef std::pair<std::pair<char, char>, char> PairT;
+ static_assert(sizeof(PairT) == 3, "");
+ static_assert(TEST_ALIGNOF(PairT) == TEST_ALIGNOF(char), "");
+ static_assert(offsetof(PairT, first) == 0, "");
}
int main(int, char**) {
- test_trivial();
- test_layout();
- return 0;
+ test_trivial();
+ test_layout();
+ return 0;
}
diff --git a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.tuple_element.verify.cpp b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.tuple_element.verify.cpp
index 7d10d8b23..4291b4aea 100644
--- a/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.tuple_element.verify.cpp
+++ b/libcxx/test/libcxx-03/utilities/utility/pairs/pairs.pair/pair.tuple_element.verify.cpp
@@ -17,5 +17,5 @@
void f() {
typedef std::pair<int, double> P;
std::tuple_element<2, P>::type foo; // expected-note {{requested here}}
- // expected-error-re@*:* {{static assertion failed{{( due to requirement '2U[L]{0,2} < 2')?}}{{.*}}Index out of bounds in std::tuple_element<std::pair<T1, T2>>}}
+ // expected-error-re@*:* {{static assertion failed{{( due to requirement '2U[L]{0,2} < 2')?}}{{.*}}Index out of bounds in std::tuple_element<std::pair<T1, T2>>}}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/144093
More information about the libcxx-commits
mailing list