https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124919
Bug ID: 124919
Summary: Using -freflection Together with import std and
#include Causes an ICE
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: printfne at gmail dot com
Target Milestone: ---
// static_serialize.cppm
module;
#include <meta>
export module static_serialize;
import std;
export template <typename T>
void serialize(T& obj) { }
// command
g++-trunk -std=c++26 -fmodules -c -fsearch-include-path bits/std.cc
g++-trunk -std=c++26 -fmodules -c -freflection ./static_serialize.cppm
// error message
In file included from /usr/include/sys/types.h:227,
from /usr/include/stdlib.h:518,
from /home/hexne/gcc-trunk/include/c++/16.0.1/cstdlib:83,
from
/home/hexne/gcc-trunk/include/c++/16.0.1/x86_64-pc-linux-gnu/bits/stdc++.h:39,
from /home/hexne/gcc-trunk/include/c++/16.0.1/bits/std.cc:26,
of module std, imported at ./static_serialize.cppm:4:
/usr/include/bits/pthreadtypes.h:72:3: error: conflicting type for imported
declaration 'typedef union pthread_mutex_t pthread_mutex_t'
72 | } pthread_mutex_t;
| ^~~~~~~~~~~~~~~
In file included from /usr/include/sys/types.h:227,
from /usr/include/stdlib.h:518,
from /home/hexne/gcc-trunk/include/c++/16.0.1/cstdlib:83,
from
/home/hexne/gcc-trunk/include/c++/16.0.1/ext/string_conversions.h:45,
from
/home/hexne/gcc-trunk/include/c++/16.0.1/bits/basic_string.h:4499,
from /home/hexne/gcc-trunk/include/c++/16.0.1/string:58,
from
/home/hexne/gcc-trunk/include/c++/16.0.1/bits/stdexcept_throw.h:57,
from /home/hexne/gcc-trunk/include/c++/16.0.1/array:44,
from /home/hexne/gcc-trunk/include/c++/16.0.1/meta:42,
from ./static_serialize.cppm:2:
/usr/include/bits/pthreadtypes.h:72:3: note: existing declaration 'typedef
union pthread_mutex_t pthread_mutex_t'
72 | } pthread_mutex_t;
| ^~~~~~~~~~~~~~~
In file included from /home/hexne/gcc-trunk/include/c++/16.0.1/string:45:
/home/hexne/gcc-trunk/include/c++/16.0.1/bits/char_traits.h:352:28: internal
compiler error: in read_definition, at cp/module.cc:14153
352 | std::construct_at(__builtin_addressof(__c1), __c2);
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x2b13fdf internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0xb58721 fancy_abort(char const*, int, char const*)
../../gcc/diagnostics/context.cc:1813
0x854c1f read_definition
../../gcc/cp/module.cc:14153
0xd0ffa1 module_state::read_cluster(unsigned int)
../../gcc/cp/module.cc:17711
0xd10acf module_state::load_section(unsigned int, binding_slot*)
../../gcc/cp/module.cc:21536
0xd10b86 module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/cp/module.cc:22565
0xd08b05 tree_node
../../gcc/cp/module.cc:11045
0xd0fc3b module_state::read_cluster(unsigned int)
../../gcc/cp/module.cc:17539
0xd10acf module_state::load_section(unsigned int, binding_slot*)
../../gcc/cp/module.cc:21536
0xd10b86 module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/cp/module.cc:22565
0xd08b05 tree_node
../../gcc/cp/module.cc:11045
0xd0fc3b module_state::read_cluster(unsigned int)
../../gcc/cp/module.cc:17539
0xd10acf module_state::load_section(unsigned int, binding_slot*)
../../gcc/cp/module.cc:21536
0xd10b86 module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/cp/module.cc:22565
0xd08b05 tree_node
../../gcc/cp/module.cc:11045
0xd0fc3b module_state::read_cluster(unsigned int)
../../gcc/cp/module.cc:17539
0xd10acf module_state::load_section(unsigned int, binding_slot*)
../../gcc/cp/module.cc:21536
0xd10b86 module_state::lazy_load(unsigned int, binding_slot*)
../../gcc/cp/module.cc:22565
0xd14efa lazy_load_pendings(tree_node*, tree_node*)
../../gcc/cp/module.cc:22666
0xe1d247 instantiate_decl(tree_node*, bool, bool)
../../gcc/cp/pt.cc:28757
/home/hexne/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/cc1plus -quiet
-D_GNU_SOURCE ./static_serialize.cppm -quiet -dumpbase static_serialize.cppm
-dumpbase-ext .cppm -mtune=generic -march=x86-64 -std=c++26 -fmodules
-freflection -o /tmp/cciOyFhK.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.