https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122381
Bug ID: 122381
Summary: Compiler crash when using exported boost container
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: d7d1cd at mail dot ru
Target Milestone: ---
Created attachment 62615
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62615&action=edit
Compiler bugreport
There's some module code that uses boost::multi_index_container:
$ cat module.ixx
module;
#include <new>
#include "boost/multi_index_container.hpp"
#include "boost/multi_index/hashed_index.hpp"
#include "boost/multi_index/ordered_index.hpp"
#include "boost/multi_index/member.hpp"
export module M;
struct Stored {
int key{};
int index{};
};
struct ByKey {};
struct ByReader {};
export using Container = boost::multi_index_container<
Stored,
boost::multi_index::indexed_by<
boost::multi_index::hashed_unique<
boost::multi_index::tag<ByKey>,
boost::multi_index::member<Stored, decltype(Stored::key),
&Stored::key>
>,
boost::multi_index::ordered_non_unique<
boost::multi_index::tag<ByReader>,
boost::multi_index::member<Stored, decltype(Stored::index),
&Stored::index>
>
>
>;
template class boost::multi_index::detail::bucket_array_base<true>;
export using ::operator new;
This module is imported and the container defined in it is used:
$ cat main.cc
import M;
int main() {
Container cont;
cont.erase(42);
}
When attempting to compile this code, the compiler crashes:
$ g++ -std=c++23 -freport-bug -fmodules-ts -I
/usr/etc/boost_1_88_0/nosan/include module.ixx main.cc
Bug report attached.
If you add the include "boost/multi_index/ordered_index.hpp" before importing
the module, compilation succeeds.