From 91dff36848dc5fd2e67b96aed9835977fcf07887 Mon Sep 17 00:00:00 2001 From: Vladimir 'virtul' Ivannikov Date: Fri, 21 Feb 2025 20:57:51 +0300 Subject: [PATCH] variant,tuple: fix/silence misc warnings msvc: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5267 Similar to neighboring C4625 Fix for warnings (errors in /WX mode) like .../variant.h(759): warning C5267: definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor (ditto for tuple). Also fix for -Wunused-parameter in variant.h (`visit_throw_bad_variant_access`) --- include/EASTL/tuple.h | 3 +++ include/EASTL/variant.h | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/EASTL/tuple.h b/include/EASTL/tuple.h index b913db24..963bbe71 100644 --- a/include/EASTL/tuple.h +++ b/include/EASTL/tuple.h @@ -16,6 +16,8 @@ EA_DISABLE_VC_WARNING(4623) // warning C4623: default constructor was implicitly defined as deleted EA_DISABLE_VC_WARNING(4625) // warning C4625: copy constructor was implicitly defined as deleted EA_DISABLE_VC_WARNING(4510) // warning C4510: default constructor could not be generated +EA_DISABLE_VC_WARNING(5267) // warning C5267: definition of implicit copy constructor for '...' is deprecated because it has a user-provided assignment operator + #if EASTL_TUPLE_ENABLED @@ -991,4 +993,5 @@ EA_CONSTEXPR decltype(auto) apply(F&& f, Tuple&& t) EA_RESTORE_VC_WARNING() EA_RESTORE_VC_WARNING() EA_RESTORE_VC_WARNING() +EA_RESTORE_VC_WARNING() #endif // EASTL_TUPLE_H diff --git a/include/EASTL/variant.h b/include/EASTL/variant.h index 1345315b..208c804b 100644 --- a/include/EASTL/variant.h +++ b/include/EASTL/variant.h @@ -81,7 +81,7 @@ static_assert(false, "eastl::variant requires a C++14 compatible compiler (at least) "); #endif -EA_DISABLE_VC_WARNING(4625) // copy constructor was implicitly defined as deleted +EA_DISABLE_VC_WARNING(4625 5267) // copy constructor was implicitly defined as deleted namespace eastl { @@ -1336,9 +1336,8 @@ namespace eastl // variant v = "Hello, Variant"; // visit(MyVisitor{}, v); // calls MyVisitor::operator()(string) {} // - EA_DISABLE_VC_WARNING(4100) // warning C4100: 't': unreferenced formal parameter template - static EA_CPP14_CONSTEXPR void visit_throw_bad_variant_access(Variants&&... variants) + static EA_CPP14_CONSTEXPR void visit_throw_bad_variant_access(EA_MAYBE_UNUSED Variants&&... variants) { #if EASTL_EXCEPTIONS_ENABLED using bool_array_type = bool[]; @@ -1352,7 +1351,6 @@ namespace eastl } #endif } - EA_RESTORE_VC_WARNING() template static EA_CONSTEXPR void visit_static_assert_check(Variants&&...)