Fix false positive warning from GCC 16 (#1591)

This commit is contained in:
Roland Reichwein 2026-09-07 14:42:44 +02:00 committed by GitHub
parent 043094129a
commit d5156f9a1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 0 deletions

View File

@ -505,6 +505,7 @@ namespace etl
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
static_assert((etl::is_default_constructible<mapped_type>::value), "mapped_type must be default constructible");
#include "private/diagnostic_uninitialized_push.h"
//*************************************************************************
///\brief Construct a const_map from a variadic list of elements.
/// Static asserts if the elements are not constructible into
@ -512,6 +513,9 @@ namespace etl
/// Static asserts if the number of elements is greater than the capacity of
/// the const_map.
//*************************************************************************
// The base class is passed the address of 'element_list' before that member has been
// initialised. The base class only stores the address and never reads through it during
// construction, so the compiler's 'may be used uninitialized' warning is a false positive.
template <typename... TElements>
ETL_CONSTEXPR14 explicit const_map(TElements&&... elements) ETL_NOEXCEPT
: iconst_map<TKey, TMapped, TKeyCompare>(element_list, sizeof...(elements), Size)
@ -521,6 +525,7 @@ namespace etl
"All elements must be constructible into value_type");
static_assert(sizeof...(elements) <= Size, "Number of elements exceeds capacity");
}
#include "private/diagnostic_pop.h"
private:

View File

@ -454,6 +454,7 @@ namespace etl
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
static_assert((etl::is_default_constructible<mapped_type>::value), "mapped_type must be default constructible");
#include "private/diagnostic_uninitialized_push.h"
//*************************************************************************
///\brief Construct a const_map from a variadic list of elements.
/// Static asserts if the element type is not constructible.
@ -462,6 +463,9 @@ namespace etl
/// Static asserts if the number of elements is greater than the capacity of
/// the const_map.
//*************************************************************************
// The base class is passed the address of 'element_list' before that member has been
// initialised. The base class only stores the address and never reads through it during
// construction, so the compiler's 'may be used uninitialized' warning is a false positive.
template <typename... TElements>
ETL_CONSTEXPR14 explicit const_multimap(TElements&&... elements) ETL_NOEXCEPT
: iconst_multimap<TKey, TMapped, TKeyCompare>(element_list, sizeof...(elements), Size)
@ -471,6 +475,7 @@ namespace etl
"All elements must be constructible into value_type");
static_assert(sizeof...(elements) <= Size, "Number of elements exceeds capacity");
}
#include "private/diagnostic_pop.h"
private:

View File

@ -409,6 +409,7 @@ namespace etl
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
#include "private/diagnostic_uninitialized_push.h"
//*************************************************************************
///\brief Construct a const_set from a variadic list of elements.
/// Static asserts if the element type is not constructible.
@ -416,6 +417,9 @@ namespace etl
/// Static asserts if the number of elements is greater than the capacity of
/// the const_set.
//*************************************************************************
// The base class is passed the address of 'element_list' before that member has been
// initialised. The base class only stores the address and never reads through it during
// construction, so the compiler's 'may be used uninitialized' warning is a false positive.
template <typename... TElements>
ETL_CONSTEXPR14 explicit const_multiset(TElements&&... elements) ETL_NOEXCEPT
: iconst_multiset<TKey, TKeyCompare>(element_list, sizeof...(elements), Size)
@ -424,6 +428,7 @@ namespace etl
static_assert((etl::are_all_same<value_type, etl::decay_t<TElements>...>::value), "All elements must be value_type");
static_assert(sizeof...(elements) <= Size, "Number of elements exceeds capacity");
}
#include "private/diagnostic_pop.h"
private:

View File

@ -403,12 +403,16 @@ namespace etl
static_assert((etl::is_default_constructible<key_type>::value), "key_type must be default constructible");
#include "private/diagnostic_uninitialized_push.h"
//*************************************************************************
///\brief Construct a const_set from a variadic list of elements.
/// Static asserts if the elements are not of type <code>value_type</code>.
/// Static asserts if the number of elements is greater than the capacity of
/// the const_set.
//*************************************************************************
// The base class is passed the address of 'element_list' before that member has been
// initialised. The base class only stores the address and never reads through it during
// construction, so the compiler's 'may be used uninitialized' warning is a false positive.
template <typename... TElements>
ETL_CONSTEXPR14 explicit const_set(TElements&&... elements) ETL_NOEXCEPT
: iconst_set<TKey, TKeyCompare>(element_list, sizeof...(elements), Size)
@ -417,6 +421,7 @@ namespace etl
static_assert((etl::are_all_same<value_type, etl::decay_t<TElements>...>::value), "All elements must be key_type");
static_assert(sizeof...(elements) <= Size, "Number of elements exceeds capacity");
}
#include "private/diagnostic_pop.h"
private: