diff --git a/include/etl/optional.h b/include/etl/optional.h index 8eefd588..901ab840 100644 --- a/include/etl/optional.h +++ b/include/etl/optional.h @@ -768,7 +768,11 @@ namespace etl { if (this != &other) { - storage.value = other.storage.value; + if (other.valid) + { + storage.value = other.storage.value; + } + valid = other.valid; } @@ -783,7 +787,7 @@ namespace etl { if (this != &other) { - if (other.has_value()) + if (other.valid) { storage.value = etl::move(other.storage.value); }