diff --git a/include/etl/private/variant_variadic.h b/include/etl/private/variant_variadic.h index d1543f701..486988aed 100644 --- a/include/etl/private/variant_variadic.h +++ b/include/etl/private/variant_variadic.h @@ -388,6 +388,12 @@ namespace etl constexpr bool operator <=(etl::monostate, etl::monostate) noexcept { return true; } constexpr bool operator >=(etl::monostate, etl::monostate) noexcept { return true; } constexpr bool operator ==(etl::monostate, etl::monostate) noexcept { return true; } +#if ETL_USING_CPP20 && ETL_USING_STL && !(defined(ETL_DEVELOPMENT_OS_APPLE) && defined(ETL_COMPILER_CLANG)) + constexpr std::strong_ordering operator<=>(monostate, monostate) noexcept + { + return std::strong_ordering::equal; + } +#endif #if ETL_NOT_USING_STL && !defined(ETL_USE_TYPE_TRAITS_BUILTINS) template <> @@ -532,7 +538,7 @@ namespace etl default_construct_in_place(data); operation = operation_type::value, etl::is_move_constructible::value>::do_operation; - type_id = variant_npos; + type_id = 0U; } #include "diagnostic_pop.h" @@ -1981,7 +1987,7 @@ namespace etl namespace private_variant { -#if ETL_USING_CPP20 && ETL_USING_STL +#if ETL_USING_CPP20 && ETL_USING_STL && !(defined(ETL_DEVELOPMENT_OS_APPLE) && defined(ETL_COMPILER_CLANG)) //*************************************************************************** /// C++20 compatible visitor function for testing variant '<=>'. /// Assumes that the two variants are already known to contain the same type. diff --git a/include/etl/version.h b/include/etl/version.h index edaef54b9..cb82de2c9 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -40,7 +40,7 @@ SOFTWARE. #define ETL_VERSION_MAJOR 20 #define ETL_VERSION_MINOR 38 -#define ETL_VERSION_PATCH 12 +#define ETL_VERSION_PATCH 13 #define ETL_VERSION ETL_STRING(ETL_VERSION_MAJOR) "." ETL_STRING(ETL_VERSION_MINOR) "." ETL_STRING(ETL_VERSION_PATCH) #define ETL_VERSION_W ETL_WIDE_STRING(ETL_VERSION_MAJOR) L"." ETL_WIDE_STRING(ETL_VERSION_MINOR) L"." ETL_WIDE_STRING(ETL_VERSION_PATCH) diff --git a/library.json b/library.json index 1eee87f5f..f430b3742 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Embedded Template Library", - "version": "20.38.12", + "version": "20.38.13", "authors": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" diff --git a/library.properties b/library.properties index 2290eecae..13fa50743 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Embedded Template Library -version=20.38.12 +version=20.38.13 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/test/test_variant_variadic.cpp b/test/test_variant_variadic.cpp index a9a7331ee..1a5b2e8bb 100644 --- a/test/test_variant_variadic.cpp +++ b/test/test_variant_variadic.cpp @@ -446,22 +446,35 @@ namespace //************************************************************************* TEST(test_constructor_default) { - CHECK_NO_THROW(test_variant_etl_3 variant_etl); + struct DefaultConstructible + { + DefaultConstructible() + : value(1) + { + } - test_variant_etl_3 variant_etl; + int value = 0; + }; + + using test_variant_t = etl::variant; + + CHECK_NO_THROW(test_variant_t variant_etl); + + test_variant_t variant_etl; - CHECK(!etl::holds_alternative(variant_etl)); - CHECK(!etl::holds_alternative(variant_etl)); - CHECK(!etl::holds_alternative(variant_etl)); + CHECK_TRUE(etl::holds_alternative(variant_etl)); + CHECK_FALSE(etl::holds_alternative(variant_etl)); + CHECK_FALSE(etl::holds_alternative(variant_etl)); + CHECK_EQUAL(1, etl::get<0U>(variant_etl).value); - CHECK(!etl::holds_alternative<0U>(variant_etl)); - CHECK(!etl::holds_alternative<1U>(variant_etl)); - CHECK(!etl::holds_alternative<2U>(variant_etl)); + CHECK_TRUE(etl::holds_alternative<0U>(variant_etl)); + CHECK_FALSE(etl::holds_alternative<1U>(variant_etl)); + CHECK_FALSE(etl::holds_alternative<2U>(variant_etl)); - CHECK(!etl::holds_alternative(0U, variant_etl)); - CHECK(!etl::holds_alternative(1U, variant_etl)); - CHECK(!etl::holds_alternative(2U, variant_etl)); - CHECK(!etl::holds_alternative(99U, variant_etl)); + CHECK_TRUE(etl::holds_alternative(0U, variant_etl)); + CHECK_FALSE(etl::holds_alternative(1U, variant_etl)); + CHECK_FALSE(etl::holds_alternative(2U, variant_etl)); + CHECK_FALSE(etl::holds_alternative(99U, variant_etl)); } //************************************************************************* diff --git a/version.txt b/version.txt index 8df06df38..af6f145e7 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -20.38.12 +20.38.13