diff --git a/libcxx/include/__format/format_error.h b/libcxx/include/__format/format_error.h --- a/libcxx/include/__format/format_error.h +++ b/libcxx/include/__format/format_error.h @@ -31,6 +31,8 @@ : runtime_error(__s) {} _LIBCPP_HIDE_FROM_ABI explicit format_error(const char* __s) : runtime_error(__s) {} + format_error(const format_error&) = default; + format_error& operator=(const format_error&) = default; virtual ~format_error() noexcept; }; diff --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h --- a/libcxx/include/__functional/function.h +++ b/libcxx/include/__functional/function.h @@ -48,6 +48,10 @@ virtual ~bad_function_call() _NOEXCEPT {} #endif + bad_function_call() = default; + bad_function_call(const bad_function_call&) = default; + bad_function_call& operator=(const bad_function_call&) = default; + #ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_GOOD_WHAT_MESSAGE virtual const char* what() const _NOEXCEPT; #endif diff --git a/libcxx/include/__memory/shared_ptr.h b/libcxx/include/__memory/shared_ptr.h --- a/libcxx/include/__memory/shared_ptr.h +++ b/libcxx/include/__memory/shared_ptr.h @@ -130,6 +130,7 @@ public: bad_weak_ptr() _NOEXCEPT = default; bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default; + bad_weak_ptr& operator=(const bad_weak_ptr&) = default; virtual ~bad_weak_ptr() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; diff --git a/libcxx/include/exception b/libcxx/include/exception --- a/libcxx/include/exception +++ b/libcxx/include/exception @@ -102,7 +102,7 @@ public: _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY exception(const exception&) _NOEXCEPT = default; - + exception& operator=(const exception&) = default; virtual ~exception() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; @@ -112,6 +112,8 @@ { public: _LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {} + bad_exception(const bad_exception&) = default; + bad_exception& operator=(const bad_exception&) = default; virtual ~bad_exception() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; @@ -237,8 +239,8 @@ exception_ptr __ptr_; public: nested_exception() _NOEXCEPT; -// nested_exception(const nested_exception&) noexcept = default; -// nested_exception& operator=(const nested_exception&) noexcept = default; + nested_exception(const nested_exception&) = default; + nested_exception& operator=(const nested_exception&) = default; virtual ~nested_exception() _NOEXCEPT; // access functions diff --git a/libcxx/include/new b/libcxx/include/new --- a/libcxx/include/new +++ b/libcxx/include/new @@ -129,6 +129,8 @@ { public: bad_alloc() _NOEXCEPT; + bad_alloc(const bad_alloc&) = default; + bad_alloc& operator=(const bad_alloc&) = default; virtual ~bad_alloc() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; @@ -138,6 +140,8 @@ { public: bad_array_new_length() _NOEXCEPT; + bad_array_new_length(const bad_array_new_length&) = default; + bad_array_new_length& operator=(const bad_array_new_length&) = default; virtual ~bad_array_new_length() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; diff --git a/libcxx/include/stdexcept b/libcxx/include/stdexcept --- a/libcxx/include/stdexcept +++ b/libcxx/include/stdexcept @@ -129,6 +129,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME domain_error(const domain_error&) _NOEXCEPT = default; + domain_error& operator=(const domain_error&) = default; virtual ~domain_error() _NOEXCEPT; #endif }; @@ -142,6 +143,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME invalid_argument(const invalid_argument&) _NOEXCEPT = default; + invalid_argument& operator=(const invalid_argument&) = default; virtual ~invalid_argument() _NOEXCEPT; #endif }; @@ -154,6 +156,7 @@ _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {} #ifndef _LIBCPP_ABI_VCRUNTIME length_error(const length_error&) _NOEXCEPT = default; + length_error& operator=(const length_error&) = default; virtual ~length_error() _NOEXCEPT; #endif }; @@ -167,6 +170,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME out_of_range(const out_of_range&) _NOEXCEPT = default; + out_of_range& operator=(const out_of_range&) = default; virtual ~out_of_range() _NOEXCEPT; #endif }; @@ -180,6 +184,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME range_error(const range_error&) _NOEXCEPT = default; + range_error& operator=(const range_error&) = default; virtual ~range_error() _NOEXCEPT; #endif }; @@ -193,6 +198,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME overflow_error(const overflow_error&) _NOEXCEPT = default; + overflow_error& operator=(const overflow_error&) = default; virtual ~overflow_error() _NOEXCEPT; #endif }; @@ -206,6 +212,7 @@ #ifndef _LIBCPP_ABI_VCRUNTIME underflow_error(const underflow_error&) _NOEXCEPT = default; + underflow_error& operator=(const underflow_error&) = default; virtual ~underflow_error() _NOEXCEPT; #endif }; diff --git a/libcxx/include/typeinfo b/libcxx/include/typeinfo --- a/libcxx/include/typeinfo +++ b/libcxx/include/typeinfo @@ -349,6 +349,7 @@ public: bad_cast() _NOEXCEPT; bad_cast(const bad_cast&) _NOEXCEPT = default; + bad_cast& operator=(const bad_cast&) = default; virtual ~bad_cast() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; @@ -358,6 +359,8 @@ { public: bad_typeid() _NOEXCEPT; + bad_typeid(const bad_typeid&) = default; + bad_typeid& operator=(const bad_typeid&) = default; virtual ~bad_typeid() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; diff --git a/libcxx/test/libcxx/assertions/single_expression.sh.cpp b/libcxx/test/libcxx/assertions/single_expression.sh.cpp --- a/libcxx/test/libcxx/assertions/single_expression.sh.cpp +++ b/libcxx/test/libcxx/assertions/single_expression.sh.cpp @@ -9,13 +9,13 @@ // Make sure that _LIBCPP_ASSERT is a single expression. This is useful so we can use // it in places that require an expression, such as in a constructor initializer list. -// RUN: %{build} -Wno-macro-redefined -D_LIBCPP_ENABLE_ASSERTIONS=1 +// RUN: %{build} -Wno-macro-redefined -Wno-comma -D_LIBCPP_ENABLE_ASSERTIONS=1 // RUN: %{run} -// RUN: %{build} -Wno-macro-redefined -D_LIBCPP_ENABLE_ASSERTIONS=0 +// RUN: %{build} -Wno-macro-redefined -Wno-comma -D_LIBCPP_ENABLE_ASSERTIONS=0 // RUN: %{run} -// RUN: %{build} -Wno-macro-redefined -D_LIBCPP_ENABLE_ASSERTIONS=0 -D_LIBCPP_ASSERTIONS_DISABLE_ASSUME +// RUN: %{build} -Wno-macro-redefined -Wno-comma -D_LIBCPP_ENABLE_ASSERTIONS=0 -D_LIBCPP_ASSERTIONS_DISABLE_ASSUME // RUN: %{run} // We flag uses of the assertion handler in older dylibs at compile-time to avoid runtime diff --git a/libcxx/test/libcxx/atomics/bit-int.verify.cpp b/libcxx/test/libcxx/atomics/bit-int.verify.cpp --- a/libcxx/test/libcxx/atomics/bit-int.verify.cpp +++ b/libcxx/test/libcxx/atomics/bit-int.verify.cpp @@ -17,6 +17,8 @@ // UNSUPPORTED: c++03 +// ADDITIONAL_COMPILE_FLAGS: -Wno-bit-int-extension + #include int main(int, char**) diff --git a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_array.pass.cpp b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_array.pass.cpp --- a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_array.pass.cpp +++ b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_array.pass.cpp @@ -24,6 +24,8 @@ int* shared_val; explicit Node(int* ptr) : shared_val(ptr) {} + Node(const Node&) = default; + Node& operator=(const Node&) = default; ~Node() { ++(*shared_val); } }; diff --git a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp --- a/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp +++ b/libcxx/test/libcxx/memory/trivial_abi/unique_ptr_destruction_order.pass.cpp @@ -26,6 +26,8 @@ explicit Base(char* buf, int* idx, char ch) : shared_buff(buf), cur_idx(idx), id(ch) {} + Base(const Base&) = default; + Base& operator=(const Base&) = delete; ~Base() { shared_buff[(*cur_idx)++] = id; } }; diff --git a/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp b/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp --- a/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp +++ b/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/move_reentrant.pass.cpp @@ -25,6 +25,8 @@ static std::function global; static bool cancel; + A() = default; + A(const A&) = default; ~A() { DoNotOptimize(cancel); if (cancel) diff --git a/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp b/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp --- a/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp +++ b/libcxx/test/libcxx/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/nullptr_t_assign_reentrant.pass.cpp @@ -25,6 +25,8 @@ static std::function global; static bool cancel; + A() = default; + A(const A&) = default; ~A() { DoNotOptimize(cancel); if (cancel) diff --git a/libcxx/test/std/concepts/concepts.lang/concept.constructible/constructible_from.compile.pass.cpp b/libcxx/test/std/concepts/concepts.lang/concept.constructible/constructible_from.compile.pass.cpp --- a/libcxx/test/std/concepts/concepts.lang/concept.constructible/constructible_from.compile.pass.cpp +++ b/libcxx/test/std/concepts/concepts.lang/concept.constructible/constructible_from.compile.pass.cpp @@ -106,9 +106,6 @@ test(); test(); test(); - test(); - test(); test(); test(); test); assert(arr[0] == 3); assert(arr[1] == 4); +TEST_DIAGNOSTIC_POP } // Test explicit type. diff --git a/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp b/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp --- a/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp +++ b/libcxx/test/std/experimental/language.support/support.coroutines/end.to.end/go.pass.cpp @@ -30,6 +30,9 @@ rh = nullptr; } + goroutine() = default; + goroutine(const goroutine&) = default; + goroutine& operator=(const goroutine&) = default; ~goroutine() {} static void go(goroutine) {} diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/back.insert.iter.ops/back.insert.iter.op=/lv_value.pass.cpp @@ -37,6 +37,7 @@ int data_; public: Copyable() : data_(0) {} + Copyable(const Copyable&) = default; ~Copyable() {data_ = -1;} friend bool operator==(const Copyable& x, const Copyable& y) diff --git a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/insert.iterators/front.insert.iter.ops/front.insert.iter.op=/lv_value.pass.cpp @@ -37,6 +37,7 @@ int data_; public: Copyable() : data_(0) {} + Copyable(const Copyable&) = default; ~Copyable() {data_ = -1;} friend bool operator==(const Copyable& x, const Copyable& y) diff --git a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/move.iterators/move.iter.ops/move.iter.op.star/op_star.pass.cpp @@ -25,6 +25,7 @@ int data_; public: A() : data_(1) {} + A(const A&) = default; ~A() {data_ = -1;} friend bool operator==(const A& x, const A& y) diff --git a/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.elem/arrow.pass.cpp b/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.elem/arrow.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.elem/arrow.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.elem/arrow.pass.cpp @@ -29,6 +29,8 @@ int data_; public: A() : data_(1) {} + A(const A&) = default; + A& operator=(const A&) = default; ~A() {data_ = -1;} int get() const {return data_;} @@ -50,6 +52,7 @@ int data_; public: B(int d=1) : data_(d) {} + B(const B&) = default; ~B() {data_ = -1;} int get() const {return data_;} diff --git a/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.elem/dereference.pass.cpp b/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.elem/dereference.pass.cpp --- a/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.elem/dereference.pass.cpp +++ b/libcxx/test/std/iterators/predef.iterators/reverse.iterators/reverse.iter.elem/dereference.pass.cpp @@ -27,6 +27,8 @@ int data_; public: A() : data_(1) {} + A(const A&) = default; + A& operator=(const A&) = default; ~A() {data_ = -1;} friend bool operator==(const A& x, const A& y) diff --git a/libcxx/test/std/language.support/support.coroutines/end.to.end/go.pass.cpp b/libcxx/test/std/language.support/support.coroutines/end.to.end/go.pass.cpp --- a/libcxx/test/std/language.support/support.coroutines/end.to.end/go.pass.cpp +++ b/libcxx/test/std/language.support/support.coroutines/end.to.end/go.pass.cpp @@ -30,6 +30,9 @@ rh = nullptr; } + goroutine() = default; + goroutine(const goroutine&) = default; + goroutine& operator=(const goroutine&) = default; ~goroutine() {} static void run_one() diff --git a/libcxx/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp b/libcxx/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp --- a/libcxx/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp +++ b/libcxx/test/std/language.support/support.exception/except.nested/rethrow_if_nested.pass.cpp @@ -28,6 +28,7 @@ int data_; public: explicit A(int data) : data_(data) {} + A(const A&) = default; virtual ~A() TEST_NOEXCEPT {} friend bool operator==(const A& x, const A& y) {return x.data_ == y.data_;} @@ -63,7 +64,6 @@ { A a(3); // not a polymorphic type --> no effect std::rethrow_if_nested(a); - assert(true); } catch (...) { @@ -75,7 +75,6 @@ { D s; // inaccessible base class --> no effect std::rethrow_if_nested(s); - assert(true); } catch (...) { @@ -87,7 +86,6 @@ { E s; // ambiguous base class --> no effect std::rethrow_if_nested(s); - assert(true); } catch (...) { @@ -123,7 +121,6 @@ try { std::rethrow_if_nested(C()); - assert(true); } catch (...) { diff --git a/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp b/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp --- a/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp +++ b/libcxx/test/std/language.support/support.start.term/quick_exit.pass.cpp @@ -23,5 +23,4 @@ int main(int, char**) { std::at_quick_exit(f); std::quick_exit(0); - return 0; } diff --git a/libcxx/test/std/ranges/range.adaptors/range.drop/dangling.cache.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.drop/dangling.cache.pass.cpp --- a/libcxx/test/std/ranges/range.adaptors/range.drop/dangling.cache.pass.cpp +++ b/libcxx/test/std/ranges/range.adaptors/range.drop/dangling.cache.pass.cpp @@ -30,6 +30,9 @@ constexpr ForwardIter end() { return ForwardIter(buff + 8); } constexpr ForwardIter end() const { return ForwardIter(); } + ZeroOnDestroy() = default; + ZeroOnDestroy(const ZeroOnDestroy&) = default; + ~ZeroOnDestroy() { std::memset(buff, 0, sizeof(buff)); } diff --git a/libcxx/test/std/ranges/range.adaptors/range.zip/iterator/singular.pass.cpp b/libcxx/test/std/ranges/range.adaptors/range.zip/iterator/singular.pass.cpp --- a/libcxx/test/std/ranges/range.adaptors/range.zip/iterator/singular.pass.cpp +++ b/libcxx/test/std/ranges/range.adaptors/range.zip/iterator/singular.pass.cpp @@ -31,8 +31,8 @@ ThrowOnIncrementIterator& operator++() { ++it_; throw 5; - return *this; } + void operator++(int) { ++it_; } int& operator*() const { return *it_; } diff --git a/libcxx/test/std/strings/string.view/string.view.cons/from_range.pass.cpp b/libcxx/test/std/strings/string.view/string.view.cons/from_range.pass.cpp --- a/libcxx/test/std/strings/string.view/string.view.cons/from_range.pass.cpp +++ b/libcxx/test/std/strings/string.view/string.view.cons/from_range.pass.cpp @@ -161,7 +161,7 @@ struct ThrowingData { char* begin() const { return nullptr; } char* end() const { return nullptr; } - char* data() const { throw 42; return nullptr; } + char* data() const { throw 42; } }; try { ThrowingData x; @@ -174,7 +174,7 @@ struct ThrowingSize { char* begin() const { return nullptr; } char* end() const { return nullptr; } - size_t size() const { throw 42; return 0; } + size_t size() const { throw 42; } }; try { ThrowingSize x; @@ -195,4 +195,3 @@ return 0; } - diff --git a/libcxx/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp --- a/libcxx/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.lock.algorithm/lock.pass.cpp @@ -88,7 +88,6 @@ bool try_lock() { TEST_THROW(1); - return locked_; } void unlock() {locked_ = false;} diff --git a/libcxx/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp b/libcxx/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp --- a/libcxx/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp +++ b/libcxx/test/std/thread/thread.mutex/thread.lock.algorithm/try_lock.pass.cpp @@ -64,7 +64,6 @@ bool try_lock() { TEST_THROW(1); - return locked_; } void unlock() {locked_ = false;} diff --git a/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp b/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp --- a/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp +++ b/libcxx/test/std/utilities/any/any.class/any.modifiers/emplace.pass.cpp @@ -27,6 +27,7 @@ struct Tracked { static int count; Tracked() {++count;} + Tracked(const Tracked&) = default; ~Tracked() { --count; } }; int Tracked::count = 0; diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp --- a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp +++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp @@ -40,6 +40,7 @@ static bool dtor_called; Y() = default; Y(int) { TEST_THROW(6);} + Y(const Y&) = default; ~Y() {dtor_called = true;} }; diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp --- a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp +++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace_initializer_list.pass.cpp @@ -31,6 +31,7 @@ constexpr X(int i, bool& dtor_called) : i_(i), dtor_called_(&dtor_called) {} constexpr X(std::initializer_list il, bool& dtor_called) : i_(il.begin()[0]), j_(il.begin()[1]), dtor_called_(&dtor_called) {} + constexpr X(const X&) = default; TEST_CONSTEXPR_CXX20 ~X() {*dtor_called_ = true;} friend constexpr bool operator==(const X& x, const X& y) @@ -57,6 +58,7 @@ public: static bool dtor_called; Z() : i_(0) {} + Z(const Z&) = default; Z(int i) : i_(i) {} Z(std::initializer_list il) : i_(il.begin()[0]), j_(il.begin()[1]) { TEST_THROW(6);} diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp --- a/libcxx/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp +++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.dtor/dtor.pass.cpp @@ -29,6 +29,7 @@ public: static bool dtor_called; X() = default; + X(const X&) = default; ~X() {dtor_called = true;} }; diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp --- a/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp +++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp @@ -23,6 +23,8 @@ struct X { static bool dtor_called; + X() = default; + X(const X&) = default; ~X() {dtor_called = true;} }; diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/alloc_first.h b/libcxx/test/std/utilities/tuple/tuple.tuple/alloc_first.h --- a/libcxx/test/std/utilities/tuple/tuple.tuple/alloc_first.h +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/alloc_first.h @@ -22,6 +22,7 @@ int data_; alloc_first() : data_(0) {} + alloc_first(const alloc_first&) = default; alloc_first(int d) : data_(d) {} alloc_first(std::allocator_arg_t, const A1& a) : data_(0) diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/alloc_last.h b/libcxx/test/std/utilities/tuple/tuple.tuple/alloc_last.h --- a/libcxx/test/std/utilities/tuple/tuple.tuple/alloc_last.h +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/alloc_last.h @@ -22,6 +22,7 @@ int data_; alloc_last() : data_(0) {} + alloc_last(const alloc_last&) = default; alloc_last(int d) : data_(d) {} alloc_last(const A1& a) : data_(0) diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.assign/convert_move.pass.cpp @@ -26,6 +26,8 @@ struct B { int id_; explicit B(int i = 0) : id_(i) {} + B(const B&) = default; + B& operator=(const B&) = default; virtual ~B() {} }; diff --git a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp --- a/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp +++ b/libcxx/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/convert_move.pass.cpp @@ -36,7 +36,7 @@ int id_; explicit B(int i) : id_(i) {} - + B(const B&) = default; virtual ~B() {} }; diff --git a/libcxx/test/std/utilities/variant/variant.visit/visit_return_type.pass.cpp b/libcxx/test/std/utilities/variant/variant.visit/visit_return_type.pass.cpp --- a/libcxx/test/std/utilities/variant/variant.visit/visit_return_type.pass.cpp +++ b/libcxx/test/std/utilities/variant/variant.visit/visit_return_type.pass.cpp @@ -233,18 +233,18 @@ } } -void test_constexpr_void() { +constexpr bool test_constexpr_void() { constexpr ReturnFirst obj{}; constexpr ReturnArity aobj{}; { using V = std::variant; constexpr V v(42); - static_assert((std::visit(obj, v), 42) == 42, ""); + std::visit(obj, v); } { using V = std::variant; constexpr V v(42l); - static_assert((std::visit(obj, v), 42) == 42, ""); + std::visit(obj, v); } { using V1 = std::variant; @@ -253,7 +253,7 @@ constexpr V1 v1; constexpr V2 v2(nullptr); constexpr V3 v3; - static_assert((std::visit(aobj, v1, v2, v3), 3) == 3, ""); + std::visit(aobj, v1, v2, v3); } { using V1 = std::variant; @@ -262,18 +262,20 @@ constexpr V1 v1; constexpr V2 v2(nullptr); constexpr V3 v3; - static_assert((std::visit(aobj, v1, v2, v3), 3) == 3, ""); + std::visit(aobj, v1, v2, v3); } { using V = std::variant; constexpr V v1(42l), v2(101), v3(nullptr), v4(1.1); - static_assert((std::visit(aobj, v1, v2, v3, v4), 4) == 4, ""); + std::visit(aobj, v1, v2, v3, v4); } { using V = std::variant; constexpr V v1(42l), v2(101), v3(nullptr), v4(1.1); - static_assert((std::visit(aobj, v1, v2, v3, v4), 4) == 4, ""); + std::visit(aobj, v1, v2, v3, v4); } + + return true; } void test_constexpr_int() { @@ -504,7 +506,7 @@ test_call_operator_forwarding(); test_argument_forwarding(); test_return_type(); - test_constexpr_void(); + static_assert(test_constexpr_void()); test_exceptions(); test_caller_accepts_nonconst(); test_call_operator_forwarding(); diff --git a/libcxx/test/support/any_helpers.h b/libcxx/test/support/any_helpers.h --- a/libcxx/test/support/any_helpers.h +++ b/libcxx/test/support/any_helpers.h @@ -286,7 +286,7 @@ throwMyAnyExpression(); } - small_throws_on_copy(small_throws_on_copy && other) throw() { + small_throws_on_copy(small_throws_on_copy && other) noexcept { value = other.value; ++count; ++moved; } @@ -326,7 +326,7 @@ throwMyAnyExpression(); } - large_throws_on_copy(large_throws_on_copy && other) throw() { + large_throws_on_copy(large_throws_on_copy && other) noexcept { value = other.value; ++count; ++moved; } diff --git a/libcxx/test/support/archetypes.h b/libcxx/test/support/archetypes.h --- a/libcxx/test/support/archetypes.h +++ b/libcxx/test/support/archetypes.h @@ -162,7 +162,7 @@ #endif // !TEST_WORKAROUND_MSVC_BROKEN_ZA_CTOR_CHECK constexpr static int check_value(int const& val) { #if TEST_STD_VER < 14 - return val == -1 || val == 999 ? (TEST_THROW(42), 0) : val; + return val == -1 || val == 999 ? TEST_THROW(42) : val; #else assert(val != -1); assert(val != 999); return val; @@ -170,7 +170,7 @@ } constexpr static int check_value(int& val, int val_cp = 0) { #if TEST_STD_VER < 14 - return val_cp = val, val = -1, (val_cp == -1 || val_cp == 999 ? (TEST_THROW(42), 0) : val_cp); + return (void)(val_cp = val), (void)(val = -1), (val_cp == -1 || val_cp == 999 ? TEST_THROW(42) : val_cp); #else assert(val != -1); assert(val != 999); val_cp = val; diff --git a/libcxx/test/support/counting_predicates.h b/libcxx/test/support/counting_predicates.h --- a/libcxx/test/support/counting_predicates.h +++ b/libcxx/test/support/counting_predicates.h @@ -18,6 +18,7 @@ typedef bool result_type; unary_counting_predicate(Predicate p) : p_(p), count_(0) {} + unary_counting_predicate(const unary_counting_predicate&) = default; ~unary_counting_predicate() {} bool operator () (const Arg &a) const { ++count_; return p_(a); } diff --git a/libcxx/test/support/deleter_types.h b/libcxx/test/support/deleter_types.h --- a/libcxx/test/support/deleter_types.h +++ b/libcxx/test/support/deleter_types.h @@ -170,6 +170,8 @@ public: CDeleter() : state_(0) {} + CDeleter(const CDeleter&) = default; + CDeleter& operator=(const CDeleter&) = default; explicit CDeleter(int s) : state_(s) {} ~CDeleter() {assert(state_ >= 0); state_ = -1;} @@ -191,6 +193,8 @@ public: CDeleter() : state_(0) {} + CDeleter(const CDeleter&) = default; + CDeleter& operator=(const CDeleter&) = default; explicit CDeleter(int s) : state_(s) {} template CDeleter(const CDeleter& d) diff --git a/libcxx/test/support/nasty_containers.h b/libcxx/test/support/nasty_containers.h --- a/libcxx/test/support/nasty_containers.h +++ b/libcxx/test/support/nasty_containers.h @@ -41,6 +41,8 @@ #if TEST_STD_VER >= 11 nasty_vector(std::initializer_list il) : v_(il) {} #endif + nasty_vector(const nasty_vector&) = default; + nasty_vector& operator=(const nasty_vector&) = default; ~nasty_vector() {} template @@ -157,6 +159,8 @@ typedef typename nested_container::const_reverse_iterator const_reverse_iterator; nasty_list() : l_() {} + nasty_list(const nasty_list&) = default; + nasty_list& operator=(const nasty_list&) = default; explicit nasty_list(size_type n) : l_(n) {} nasty_list(size_type n, const value_type& value) : l_(n,value) {} template diff --git a/libcxx/utils/libcxx/test/params.py b/libcxx/utils/libcxx/test/params.py --- a/libcxx/utils/libcxx/test/params.py +++ b/libcxx/utils/libcxx/test/params.py @@ -7,22 +7,38 @@ #===----------------------------------------------------------------------===## from libcxx.test.dsl import * -from libcxx.test.features import _isMSVC +from libcxx.test.features import _isMSVC, _isClang import re _warningFlags = [ - '-Werror', '-Wall', + '-Walloca', + '-Wcomma', '-Wextra', + '-Werror', '-Wshadow', '-Wundef', + '-Wunreachable-code-aggressive', + '-Wvla', + + # GCC warns on redundant declarations which are needed for C++03 support + lambda cfg: '-Wdeprecated' if _isClang(cfg) else '', + + # Because C++03 is supported throw() has to be used in a lot of places still + '-Wno-deprecated-dynamic-exception-spec', + + # We use a lot of extensions, so it doesn't make sense to warn on them + '-Wno-pedantic', + '-Wno-unused-command-line-argument', '-Wno-attributes', - '-Wno-pessimizing-move', - '-Wno-c++11-extensions', '-Wno-noexcept-type', '-Wno-aligned-allocation-unavailable', '-Wno-atomic-alignment', + '-Wno-unused-local-typedef', + + # We only support C++03 with Clang extensions + '-Wno-c++11-extensions', # GCC warns about places where we might want to add sized allocation/deallocation # functions, but we know better what we're doing/testing in the test suite. @@ -39,8 +55,6 @@ '-Wsign-compare', '-Wunused-variable', '-Wunused-parameter', - '-Wunreachable-code', - '-Wno-unused-local-typedef', ] _allStandards = ['c++03', 'c++11', 'c++14', 'c++17', 'c++20', 'c++2b']