Skip to content

Another uninitialized warning with gcc 16 #103

Closed

Description

@J-Richter

This program:

#include <boost/multi_index_container.hpp>
#include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/sequenced_index.hpp>
#include <boost/multi_index/key.hpp>

struct HashIndex;
struct SequenceIndex;

using HashedThenSequenced = boost::multi_index::multi_index_container<
  int,
  boost::multi_index::indexed_by<
    boost::multi_index::hashed_unique<
      boost::multi_index::tag<HashIndex>,
      boost::multi_index::identity<int>>,
    boost::multi_index::sequenced< boost::multi_index::tag<SequenceIndex> >
    >
  >;

int main()
{
  HashedThenSequenced container;
  return container.empty() ? 0 : 1;
}
/tools/pkg/gcc/16.2.0/bin/g++ -std=gnu++23 -Og -Wall -Wextra -Wuninitialized -Werror=uninitialized \
  -I/ws/jrichter/hf/def/toolsinclude \
  -c /ws/jrichter/hf/src/base/stl/check.multiIndexUninit.cc \
  -o /tmp/check.multiIndexUninit.o

generates this warning:

...member' is used uninitialized [-Werror=uninitialized]

Switching the order of the indexes fixes the warning.

Activity

  1. joaquintides commented on Sep 16, 2026

    @joaquintides
    Member

    Hi Jörg, can you verify if #104 solves the problem at your end? Thank you!

  2. J-Richter commented on Sep 21, 2026

    @J-Richter
    Author

    The warning is gone, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions