Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package aws-crt-cpp for openSUSE:Factory checked in at 2025-04-16 20:39:28 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/aws-crt-cpp (Old) and /work/SRC/openSUSE:Factory/.aws-crt-cpp.new.30101 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "aws-crt-cpp" Wed Apr 16 20:39:28 2025 rev:27 rq:1269946 version:0.32.4 Changes: -------- --- /work/SRC/openSUSE:Factory/aws-crt-cpp/aws-crt-cpp.changes 2025-03-26 21:25:18.807218900 +0100 +++ /work/SRC/openSUSE:Factory/.aws-crt-cpp.new.30101/aws-crt-cpp.changes 2025-04-20 19:49:59.139922579 +0200 @@ -1,0 +2,23 @@ +Tue Apr 15 10:26:32 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to version 0.32.4 + * Bump crt checksums by @DmitriyMusatkin in (#730) + +------------------------------------------------------------------- +Mon Apr 7 07:02:59 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaub...@suse.com> + +- Update to version 0.32.3 + * Fix assignment operator in Optional by @sfod in (#720) + * Fix clang error in string view by @sbiscigl in (#728) +- from version 0.32.2 + * Revert checksums header install location change + by @DmitriyMusatkin in (#726) +- from version 0.31.2 + * Fix flaky CBOR test by @graebm in (#718) + * Use latest PQ TLS Cipher Preference in Tests by @alexw91 in (#717) + * Fix "std-compat" CI to actually test what it's supposed to + by @graebm in (#719) + * Fix IP address being labelled "bad" for too long by @graebm in (#723) + * Initialize checksums explicitly by @DmitriyMusatkin in (#722) + +------------------------------------------------------------------- Old: ---- v0.31.1.tar.gz New: ---- v0.32.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ aws-crt-cpp.spec ++++++ --- /var/tmp/diff_new_pack.Fhqi1c/_old 2025-04-20 19:49:59.643943554 +0200 +++ /var/tmp/diff_new_pack.Fhqi1c/_new 2025-04-20 19:49:59.643943554 +0200 @@ -20,7 +20,7 @@ %define library_soversion 1 Name: aws-crt-cpp -Version: 0.31.1 +Version: 0.32.4 Release: 0 Summary: AWS C++ wrapper for AWS SDK C libraries License: Apache-2.0 ++++++ v0.31.1.tar.gz -> v0.32.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.31.1/.github/workflows/ci.yml new/aws-crt-cpp-0.32.4/.github/workflows/ci.yml --- old/aws-crt-cpp-0.31.1/.github/workflows/ci.yml 2025-03-17 17:58:21.000000000 +0100 +++ new/aws-crt-cpp-0.32.4/.github/workflows/ci.yml 2025-04-14 18:54:36.000000000 +0200 @@ -7,7 +7,7 @@ - 'docs' env: - BUILDER_VERSION: v0.9.73 + BUILDER_VERSION: v0.9.76 BUILDER_SOURCE: releases BUILDER_HOST: https://d19elf31gohf1l.cloudfront.net PACKAGE_NAME: aws-crt-cpp @@ -65,6 +65,7 @@ with: role-to-assume: ${{ env.CRT_CI_ROLE }} aws-region: ${{ env.AWS_DEFAULT_REGION }} + role-duration-seconds: 7200 # 2 hours - name: Install qemu/docker run: docker run --privileged --rm tonistiigi/binfmt --install all - name: Build ${{ env.PACKAGE_NAME }} @@ -117,6 +118,7 @@ with: role-to-assume: ${{ env.CRT_CI_ROLE }} aws-region: ${{ env.AWS_DEFAULT_REGION }} + role-duration-seconds: 7200 # 2 hours # set arm arch - name: Install qemu/docker run: docker run --privileged --rm tonistiigi/binfmt --install linux/arm/v7 @@ -131,18 +133,17 @@ strategy: matrix: compiler: [gcc-8, clang-9] - std: [c++11, c++14, c++17, c++2a] + cxx-std: ["11", "14", "17", "20"] steps: - uses: aws-actions/configure-aws-credentials@v4 with: role-to-assume: ${{ env.CRT_CI_ROLE }} aws-region: ${{ env.AWS_DEFAULT_REGION }} # We can't use the `uses: docker://image` version yet, GitHub lacks authentication for actions -> packages - - name: Build ${{ env.PACKAGE_NAME }} with ${{ matrix.std }} + - name: Build ${{ env.PACKAGE_NAME }} with cxx${{ matrix.cxx-std }} run: | - export CXXFLAGS=-std=${{ matrix.std }} aws s3 cp s3://aws-crt-test-stuff/ci/${{ env.BUILDER_VERSION }}/linux-container-ci.sh ./linux-container-ci.sh && chmod a+x ./linux-container-ci.sh - ./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ env.LINUX_BASE_IMAGE }} build -p ${{ env.PACKAGE_NAME }} --compiler=${{ matrix.compiler }} --cmake-extra=-DUSE_OPENSSL=ON + ./linux-container-ci.sh ${{ env.BUILDER_VERSION }} aws-crt-${{ env.LINUX_BASE_IMAGE }} build -p ${{ env.PACKAGE_NAME }} --compiler=${{ matrix.compiler }} --cmake-extra=-DUSE_OPENSSL=ON --cmake-extra=-DCMAKE_CXX_STANDARD=${{ matrix.cxx-std }} byo-crypto: runs-on: ubuntu-24.04 # latest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.31.1/VERSION new/aws-crt-cpp-0.32.4/VERSION --- old/aws-crt-cpp-0.31.1/VERSION 2025-03-17 17:58:21.000000000 +0100 +++ new/aws-crt-cpp-0.32.4/VERSION 2025-04-14 18:54:36.000000000 +0200 @@ -1 +1 @@ -0.31.1 +0.32.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.31.1/include/aws/crt/Exports.h new/aws-crt-cpp-0.32.4/include/aws/crt/Exports.h --- old/aws-crt-cpp-0.31.1/include/aws/crt/Exports.h 2025-03-17 17:58:21.000000000 +0100 +++ new/aws-crt-cpp-0.32.4/include/aws/crt/Exports.h 2025-04-14 18:54:36.000000000 +0200 @@ -15,7 +15,7 @@ * permissions and limitations under the License. */ -#if defined(USE_WINDOWS_DLL_SEMANTICS) || defined(WIN32) +#if defined(AWS_CRT_USE_WINDOWS_DLL_SEMANTICS) || defined(_WIN32) # ifdef _MSC_VER # pragma warning(disable : 4251) # endif // _MSC_VER @@ -29,11 +29,10 @@ # define AWS_CRT_CPP_API # endif // AWS_CRT_CPP_USE_IMPORT_EXPORT -#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) -# if ((__GNUC__ >= 4) || defined(__clang__)) && defined(AWS_CRT_CPP_USE_IMPORT_EXPORT) && \ - defined(AWS_CRT_CPP_EXPORTS) +#else // defined (AWS_CRT_USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) +# if defined(AWS_CRT_CPP_USE_IMPORT_EXPORT) && defined(AWS_CRT_CPP_EXPORTS) # define AWS_CRT_CPP_API __attribute__((visibility("default"))) # else # define AWS_CRT_CPP_API -# endif // __GNUC__ >= 4 || defined(__clang__) +# endif #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.31.1/include/aws/crt/Optional.h new/aws-crt-cpp-0.32.4/include/aws/crt/Optional.h --- old/aws-crt-cpp-0.31.1/include/aws/crt/Optional.h 2025-03-17 17:58:21.000000000 +0100 +++ new/aws-crt-cpp-0.32.4/include/aws/crt/Optional.h 2025-04-14 18:54:36.000000000 +0200 @@ -3,6 +3,7 @@ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ +#include <aws/crt/TypeTraits.h> #include <aws/crt/Utility.h> #include <utility> @@ -17,6 +18,8 @@ template <typename T> class Optional { public: + using ValueType = T; + Optional() : m_value(nullptr) {} Optional(const T &val) { @@ -38,7 +41,15 @@ } } - template <typename U = T> Optional &operator=(U &&u) + /** + * Assignment operator for a case when the parameter type is not Optional. + */ + template < + typename U = T, + typename std::enable_if< + !IsSpecializationOf<typename std::decay<U>::type, Aws::Crt::Optional>::value, + bool>::type = true> + Optional &operator=(U &&u) { if (m_value) { @@ -84,98 +95,11 @@ m_value = reinterpret_cast<T *>(m_storage); } - Optional &operator=(const Optional &other) - { - if (this == &other) - { - return *this; - } - - if (m_value) - { - if (other.m_value) - { - *m_value = *other.m_value; - } - else - { - m_value->~T(); - m_value = nullptr; - } - - return *this; - } - - if (other.m_value) - { - new (m_storage) T(*other.m_value); - m_value = reinterpret_cast<T *>(m_storage); - } - - return *this; - } - - template <typename U = T> Optional<T> &operator=(const Optional<U> &other) - { - if (this == &other) - { - return *this; - } - - if (m_value) - { - if (other.m_value) - { - *m_value = *other.m_value; - } - else - { - m_value->~T(); - m_value = nullptr; - } - - return *this; - } - - if (other.m_value) - { - new (m_storage) T(*other.m_value); - m_value = reinterpret_cast<T *>(m_storage); - } - - return *this; - } - - template <typename U = T> Optional<T> &operator=(Optional<U> &&other) - { - if (this == &other) - { - return *this; - } - - if (m_value) - { - if (other.m_value) - { - *m_value = std::forward<U>(*other.m_value); - } - else - { - m_value->~T(); - m_value = nullptr; - } - - return *this; - } + Optional<T> &operator=(const Optional &other) { return assign(other); } - if (other.m_value) - { - new (m_storage) T(std::forward<U>(*other.m_value)); - m_value = reinterpret_cast<T *>(m_storage); - } + template <typename U = T> Optional<T> &operator=(const Optional<U> &other) { return assign(other); } - return *this; - } + template <typename U = T> Optional<T> &operator=(Optional<U> &&other) { return assign(std::move(other)); } template <typename... Args> T &emplace(Args &&...args) { @@ -213,6 +137,47 @@ } private: + template <typename Op> Optional &assign(Op &&other) + { + // U is an underlying type of the Optional type passed to this function. Depending on constness of Op, + // U will be either value or const ref. + // NOTE: std::is_const<const C&> == false, that's why std::remove_reference is needed here. + using U = typename std::conditional< + std::is_const<typename std::remove_reference<Op>::type>::value, + const typename std::decay<Op>::type::ValueType &, + typename std::decay<Op>::type::ValueType>::type; + + if ((void *)this == (void *)&other) + { + return *this; + } + + if (m_value) + { + // Optional<U> is a completely different class from the C++ specifics pov. So, we can use only + // public members of `other`. + if (other.has_value()) + { + *m_value = std::forward<U>(other.value()); + } + else + { + m_value->~T(); + m_value = nullptr; + } + + return *this; + } + + if (other.has_value()) + { + new (m_storage) T(std::forward<U>(other.value())); + m_value = reinterpret_cast<T *>(m_storage); + } + + return *this; + } + alignas(T) char m_storage[sizeof(T)]; T *m_value; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.31.1/include/aws/crt/StringView.h new/aws-crt-cpp-0.32.4/include/aws/crt/StringView.h --- old/aws-crt-cpp-0.31.1/include/aws/crt/StringView.h 2025-03-17 17:58:21.000000000 +0100 +++ new/aws-crt-cpp-0.32.4/include/aws/crt/StringView.h 2025-04-14 18:54:36.000000000 +0200 @@ -820,25 +820,35 @@ { inline namespace string_view_literals { - inline basic_string_view<char> operator"" _sv(const char *s, size_t length) noexcept +#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ <= 8) +/* On GCC <= 4.8, use old syntax for literal operator (with space after ""). It can't do the modern syntax */ +# define OPERATOR_LITERAL_SV operator"" _sv +#else +/* else use modern syntax (no space after "") to avoid -Wdeprecated-literal-operator warning on Clang 16+ */ +# define OPERATOR_LITERAL_SV operator""_sv +#endif + + inline basic_string_view<char> OPERATOR_LITERAL_SV(const char *s, size_t length) noexcept { return basic_string_view<char>(s, length); } - inline basic_string_view<wchar_t> operator"" _sv(const wchar_t * s, size_t length) noexcept + inline basic_string_view<wchar_t> OPERATOR_LITERAL_SV(const wchar_t *s, size_t length) noexcept { return basic_string_view<wchar_t>(s, length); } - inline basic_string_view<char16_t> operator"" _sv(const char16_t *s, size_t length) noexcept + inline basic_string_view<char16_t> OPERATOR_LITERAL_SV(const char16_t *s, size_t length) noexcept { return basic_string_view<char16_t>(s, length); } - inline basic_string_view<char32_t> operator"" _sv(const char32_t *s, size_t length) noexcept + inline basic_string_view<char32_t> OPERATOR_LITERAL_SV(const char32_t *s, size_t length) noexcept { return basic_string_view<char32_t>(s, length); } + +#undef OPERATOR_LITERAL_SV } // namespace string_view_literals } // namespace literals diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.31.1/include/aws/crt/TypeTraits.h new/aws-crt-cpp-0.32.4/include/aws/crt/TypeTraits.h --- old/aws-crt-cpp-0.31.1/include/aws/crt/TypeTraits.h 1970-01-01 01:00:00.000000000 +0100 +++ new/aws-crt-cpp-0.32.4/include/aws/crt/TypeTraits.h 2025-04-14 18:54:36.000000000 +0200 @@ -0,0 +1,30 @@ +#pragma once +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + +#include <type_traits> + +namespace Aws +{ + namespace Crt + { + /** + * A type trait for determining if the first template parameter is a template specialization of the second + * template parameter. Based on p2098 (https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2098r1.pdf). + * + * @note Known limitations: does not support template classes with non-type template parameter, e.g. std::array. + */ + template <typename T, template <typename...> class Primary> struct IsSpecializationOf : std::false_type + { + }; + + /* Specialization for the case when the first template parameter is a template specialization of the second + * template parameter. */ + template <template <typename...> class Primary, typename... Args> + struct IsSpecializationOf<Primary<Args...>, Primary> : std::true_type + { + }; + } // namespace Crt +} // namespace Aws diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.31.1/source/Api.cpp new/aws-crt-cpp-0.32.4/source/Api.cpp --- old/aws-crt-cpp-0.31.1/source/Api.cpp 2025-03-17 17:58:21.000000000 +0100 +++ new/aws-crt-cpp-0.32.4/source/Api.cpp 2025-04-14 18:54:36.000000000 +0200 @@ -9,6 +9,7 @@ #include <aws/crt/io/TlsOptions.h> #include <aws/auth/auth.h> +#include <aws/checksums/checksums.h> #include <aws/common/ref_count.h> #include <aws/event-stream/event_stream.h> #include <aws/http/http.h> @@ -48,6 +49,7 @@ aws_s3_library_init(allocator); aws_event_stream_library_init(allocator); aws_sdkutils_library_init(allocator); + aws_checksums_library_init(allocator); JsonObject::OnLibraryInit(); } @@ -78,6 +80,7 @@ aws_mqtt_library_clean_up(); aws_event_stream_library_clean_up(); aws_sdkutils_library_clean_up(); + aws_checksums_library_clean_up(); s_BYOCryptoNewMD5Callback = nullptr; s_BYOCryptoNewSHA256Callback = nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.31.1/tests/CborTest.cpp new/aws-crt-cpp-0.32.4/tests/CborTest.cpp --- old/aws-crt-cpp-0.31.1/tests/CborTest.cpp 2025-03-17 17:58:21.000000000 +0100 +++ new/aws-crt-cpp-0.32.4/tests/CborTest.cpp 2025-04-14 18:54:36.000000000 +0200 @@ -184,8 +184,8 @@ { double double_val = decoder.PopNextFloatVal().value(); std::chrono::duration<double, std::chrono::seconds::period> timestamp(double_val); - outTimePoint = - std::chrono::system_clock::time_point(std::chrono::duration_cast<std::chrono::milliseconds>(timestamp)); + outTimePoint = std::chrono::system_clock::time_point( + std::chrono::duration_cast<std::chrono::system_clock::duration>(timestamp)); return AWS_OP_SUCCESS; } default: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.31.1/tests/HttpClientConnectionManagerTest.cpp new/aws-crt-cpp-0.32.4/tests/HttpClientConnectionManagerTest.cpp --- old/aws-crt-cpp-0.31.1/tests/HttpClientConnectionManagerTest.cpp 2025-03-17 17:58:21.000000000 +0100 +++ new/aws-crt-cpp-0.32.4/tests/HttpClientConnectionManagerTest.cpp 2025-04-14 18:54:36.000000000 +0200 @@ -36,7 +36,7 @@ // Ensure that if PQ TLS ciphers are supported on the current platform, that setting them works when connecting // to S3. This TlsCipherPreference has post quantum ciphers at the top of it's preference list (that will be // ignored if S3 doesn't support them) followed by regular TLS ciphers that can be chosen and negotiated by S3. - aws_tls_cipher_pref tls_cipher_pref = AWS_IO_TLS_CIPHER_PREF_PQ_TLSv1_0_2021_05; + aws_tls_cipher_pref tls_cipher_pref = AWS_IO_TLS_CIPHER_PREF_PQ_DEFAULT; if (aws_tls_is_cipher_pref_supported(tls_cipher_pref)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-crt-cpp-0.31.1/tests/OptionalMemorySafetyTest.cpp new/aws-crt-cpp-0.32.4/tests/OptionalMemorySafetyTest.cpp --- old/aws-crt-cpp-0.31.1/tests/OptionalMemorySafetyTest.cpp 2025-03-17 17:58:21.000000000 +0100 +++ new/aws-crt-cpp-0.32.4/tests/OptionalMemorySafetyTest.cpp 2025-04-14 18:54:36.000000000 +0200 @@ -107,7 +107,14 @@ class CopyMoveTester { public: - CopyMoveTester() : m_copied(false), m_moved(false) {} + struct Initer + { + }; + + CopyMoveTester() = default; + explicit CopyMoveTester(const Initer &) : m_initer_copied(true) {} + explicit CopyMoveTester(Initer &&) : m_initer_moved(true) {} + CopyMoveTester(const CopyMoveTester &) : m_copied(true), m_moved(false) {} CopyMoveTester(CopyMoveTester &&) : m_copied(false), m_moved(true) {} @@ -115,19 +122,43 @@ { m_copied = true; m_moved = false; + m_initer_copied = false; + m_initer_moved = false; return *this; } CopyMoveTester &operator=(CopyMoveTester &&) { m_copied = false; m_moved = true; + m_initer_copied = false; + m_initer_moved = false; + return *this; + } + + CopyMoveTester &operator=(const Initer &) + { + m_copied = false; + m_moved = false; + m_initer_copied = true; + m_initer_moved = false; + return *this; + } + + CopyMoveTester &operator=(Initer &&) + { + m_copied = false; + m_moved = false; + m_initer_copied = false; + m_initer_moved = true; return *this; } ~CopyMoveTester() {} - bool m_copied; - bool m_moved; + bool m_copied = false; + bool m_moved = false; + bool m_initer_copied = false; + bool m_initer_moved = false; }; static int s_OptionalCopyAndMoveSemantics(struct aws_allocator *allocator, void *ctx) @@ -140,40 +171,163 @@ ASSERT_FALSE(initialItem.m_copied); ASSERT_FALSE(initialItem.m_moved); - Aws::Crt::Optional<CopyMoveTester> copyConstructedValue(initialItem); - ASSERT_TRUE(copyConstructedValue->m_copied); - ASSERT_FALSE(copyConstructedValue->m_moved); - - Aws::Crt::Optional<CopyMoveTester> copyConstructedOptional(copyConstructedValue); - ASSERT_TRUE(copyConstructedOptional->m_copied); - ASSERT_FALSE(copyConstructedOptional->m_moved); - - Aws::Crt::Optional<CopyMoveTester> copyAssignedValue = initialItem; - ASSERT_TRUE(copyAssignedValue->m_copied); - ASSERT_FALSE(copyAssignedValue->m_moved); - - Aws::Crt::Optional<CopyMoveTester> copyAssignedOptional = copyConstructedOptional; - ASSERT_TRUE(copyAssignedOptional->m_copied); - ASSERT_FALSE(copyAssignedOptional->m_moved); - - Aws::Crt::Optional<CopyMoveTester> moveConstructedValue(std::move(initialItem)); - ASSERT_FALSE(moveConstructedValue->m_copied); - ASSERT_TRUE(moveConstructedValue->m_moved); - - Aws::Crt::Optional<CopyMoveTester> moveConstructedOptional(std::move(moveConstructedValue)); - ASSERT_FALSE(moveConstructedOptional->m_copied); - ASSERT_TRUE(moveConstructedOptional->m_moved); - - Aws::Crt::Optional<CopyMoveTester> moveAssignedValue = std::move(*moveConstructedOptional); - ASSERT_FALSE(moveAssignedValue->m_copied); - ASSERT_TRUE(moveAssignedValue->m_moved); - - Aws::Crt::Optional<CopyMoveTester> moveAssignedOptional = std::move(moveAssignedValue); - ASSERT_FALSE(moveAssignedOptional->m_copied); - ASSERT_TRUE(moveAssignedOptional->m_moved); + { + // Optional(const U&), where U == T + Aws::Crt::Optional<CopyMoveTester> copyConstructedValue(initialItem); + ASSERT_TRUE(copyConstructedValue->m_copied); + ASSERT_FALSE(copyConstructedValue->m_moved); + + // Optional(const Optional<U>&), where U == T + Aws::Crt::Optional<CopyMoveTester> copyConstructedOptional(copyConstructedValue); + ASSERT_TRUE(copyConstructedOptional->m_copied); + ASSERT_FALSE(copyConstructedOptional->m_moved); + } + + { + // operator=(const U&), where U == T + Aws::Crt::Optional<CopyMoveTester> copyAssignedValue; + // Assignment to empty Optional. + copyAssignedValue = initialItem; + ASSERT_TRUE(copyAssignedValue->m_copied); + ASSERT_FALSE(copyAssignedValue->m_moved); + // Assignment to non-empty Optional. + copyAssignedValue = initialItem; + ASSERT_TRUE(copyAssignedValue->m_copied); + ASSERT_FALSE(copyAssignedValue->m_moved); + } + + { + // operator=(const U&), where U != T + Aws::Crt::Optional<CopyMoveTester> copyAssignedOtherValue; + CopyMoveTester::Initer copyIniter; + // Assignment to empty Optional. + copyAssignedOtherValue = copyIniter; + ASSERT_FALSE(copyAssignedOtherValue->m_copied); + ASSERT_FALSE(copyAssignedOtherValue->m_moved); + ASSERT_TRUE(copyAssignedOtherValue->m_initer_copied); + ASSERT_FALSE(copyAssignedOtherValue->m_initer_moved); + // Assignment to non-empty Optional. + copyAssignedOtherValue = copyIniter; + ASSERT_FALSE(copyAssignedOtherValue->m_copied); + ASSERT_FALSE(copyAssignedOtherValue->m_moved); + ASSERT_TRUE(copyAssignedOtherValue->m_initer_copied); + ASSERT_FALSE(copyAssignedOtherValue->m_initer_moved); + } + + { + // operator=(const Optional<U>&), where U == T + Aws::Crt::Optional<CopyMoveTester> copyAssignedOptional; + Aws::Crt::Optional<CopyMoveTester> tester = CopyMoveTester(); + // Assignment to empty Optional. + copyAssignedOptional = tester; + ASSERT_TRUE(copyAssignedOptional->m_copied); + ASSERT_FALSE(copyAssignedOptional->m_moved); + // Assignment to non-empty Optional. + copyAssignedOptional = tester; + ASSERT_TRUE(copyAssignedOptional->m_copied); + ASSERT_FALSE(copyAssignedOptional->m_moved); + } + + { + // operator=(const Optional<U>&), where U != T + Aws::Crt::Optional<CopyMoveTester> copyAssignedOtherOptional; + Aws::Crt::Optional<CopyMoveTester::Initer> copyIniterOptional = CopyMoveTester::Initer(); + // Assignment to empty Optional. + copyAssignedOtherOptional = copyIniterOptional; + ASSERT_FALSE(copyAssignedOtherOptional->m_copied); + ASSERT_FALSE(copyAssignedOtherOptional->m_moved); + ASSERT_TRUE(copyAssignedOtherOptional->m_initer_copied); + ASSERT_FALSE(copyAssignedOtherOptional->m_initer_moved); + // Assignment to non-empty Optional. + copyAssignedOtherOptional = copyIniterOptional; + ASSERT_FALSE(copyAssignedOtherOptional->m_copied); + ASSERT_FALSE(copyAssignedOtherOptional->m_moved); + ASSERT_TRUE(copyAssignedOtherOptional->m_initer_copied); + ASSERT_FALSE(copyAssignedOtherOptional->m_initer_moved); + } + + { + // Optional(U&&), where U == T + Aws::Crt::Optional<CopyMoveTester> moveConstructedValue(std::move(initialItem)); + ASSERT_FALSE(moveConstructedValue->m_copied); + ASSERT_TRUE(moveConstructedValue->m_moved); + + // Optional(Optional<U>&&), where U == T + Aws::Crt::Optional<CopyMoveTester> moveConstructedOptional(std::move(moveConstructedValue)); + ASSERT_FALSE(moveConstructedOptional->m_copied); + ASSERT_TRUE(moveConstructedOptional->m_moved); + } + + { + // operator=(U&&), where U == T + Aws::Crt::Optional<CopyMoveTester> moveAssignedValue; + CopyMoveTester tester; + // Assignment to empty Optional. + moveAssignedValue = std::move(tester); + ASSERT_FALSE(moveAssignedValue->m_copied); + ASSERT_TRUE(moveAssignedValue->m_moved); + // Assignment to non-empty Optional. + tester = CopyMoveTester(); + moveAssignedValue = std::move(tester); + ASSERT_FALSE(moveAssignedValue->m_copied); + ASSERT_TRUE(moveAssignedValue->m_moved); + } + + { + // operator=(U&&), where U != T + Aws::Crt::Optional<CopyMoveTester> moveAssignedOtherValue; + CopyMoveTester::Initer moveIniter; + // Assignment to empty Optional. + moveAssignedOtherValue = std::move(moveIniter); + ASSERT_FALSE(moveAssignedOtherValue->m_copied); + ASSERT_FALSE(moveAssignedOtherValue->m_moved); + ASSERT_FALSE(moveAssignedOtherValue->m_initer_copied); + ASSERT_TRUE(moveAssignedOtherValue->m_initer_moved); + // Assignment to non-empty Optional. + moveIniter = CopyMoveTester::Initer(); + moveAssignedOtherValue = std::move(moveIniter); + ASSERT_FALSE(moveAssignedOtherValue->m_copied); + ASSERT_FALSE(moveAssignedOtherValue->m_moved); + ASSERT_FALSE(moveAssignedOtherValue->m_initer_copied); + ASSERT_TRUE(moveAssignedOtherValue->m_initer_moved); + } + + { + // operator=(Optional<U>&&), where U == T + Aws::Crt::Optional<CopyMoveTester> moveAssignedOptional; + Aws::Crt::Optional<CopyMoveTester> tester = CopyMoveTester(); + // Assignment to empty Optional. + moveAssignedOptional = std::move(tester); + ASSERT_FALSE(moveAssignedOptional->m_copied); + ASSERT_TRUE(moveAssignedOptional->m_moved); + // Assignment to non-empty Optional. + tester = CopyMoveTester(); + moveAssignedOptional = std::move(tester); + ASSERT_FALSE(moveAssignedOptional->m_copied); + ASSERT_TRUE(moveAssignedOptional->m_moved); + } + + { + // operator=(Optional<U>&&), where U != T + Aws::Crt::Optional<CopyMoveTester> moveAssignedOtherOptional; + Aws::Crt::Optional<CopyMoveTester::Initer> moveIniterOptional = CopyMoveTester::Initer(); + // Assignment to empty Optional. + moveAssignedOtherOptional = std::move(moveIniterOptional); + ASSERT_FALSE(moveAssignedOtherOptional->m_copied); + ASSERT_FALSE(moveAssignedOtherOptional->m_moved); + ASSERT_FALSE(moveAssignedOtherOptional->m_initer_copied); + ASSERT_TRUE(moveAssignedOtherOptional->m_initer_moved); + // Assignment to non-empty Optional. + moveIniterOptional = CopyMoveTester::Initer(); + moveAssignedOtherOptional = std::move(moveIniterOptional); + ASSERT_FALSE(moveAssignedOtherOptional->m_copied); + ASSERT_FALSE(moveAssignedOtherOptional->m_moved); + ASSERT_FALSE(moveAssignedOtherOptional->m_initer_copied); + ASSERT_TRUE(moveAssignedOtherOptional->m_initer_moved); + } } return AWS_OP_SUCCESS; } -AWS_TEST_CASE(OptionalCopyAndMoveSemantics, s_OptionalCopyAndMoveSemantics) \ No newline at end of file +AWS_TEST_CASE(OptionalCopyAndMoveSemantics, s_OptionalCopyAndMoveSemantics)