Returning const ref of member from const member function (#1052)

The `const` marked function needs to return a `const` reference to a member variable

Co-authored-by: Andreas Pelczer <pelczer@stoerk-tronic.com>
This commit is contained in:
Andreas 2025-03-26 13:17:23 +01:00 committed by GitHub
parent a12dbbd911
commit c547b7804f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -188,7 +188,7 @@ namespace etl
//*******************************************
/// Get the error.
//*******************************************
//*******************************************
ETL_CONSTEXPR14 TError&& error() const&& ETL_NOEXCEPT
{
return etl::move(error_value);
@ -500,7 +500,7 @@ namespace etl
//*******************************************
/// Get the value.
//*******************************************
value_type& value() const
const value_type& value() const
{
return etl::get<Value_Type>(storage);
}
@ -660,7 +660,7 @@ namespace etl
//*******************************************
///
//*******************************************
error_type& error() const
const error_type& error() const
{
return etl::get<Error_Type>(storage);
}
@ -932,7 +932,7 @@ namespace etl
/// Returns the error
/// Undefined behaviour if an error has not been set.
//*******************************************
error_type& error() const
const error_type& error() const
{
return etl::get<Error_Type>(storage);
}
@ -1107,4 +1107,3 @@ void swap(etl::unexpected<TError>& lhs, etl::unexpected<TError>& rhs)
}
#endif