https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120349
Bug ID: 120349 Summary: [16 regression] std::println link fail with std module Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: c at cyano dot cn Target Milestone: --- `test.cc`: ``` import std; int main() { std::println("Hello, {0}!", "world"); return 0; } ``` Compiled with: ``` g++ -std=c++23 -fmodules -O2 -fmodule-only -fsearch-include-path -c bits/std.cc g++ -std=c++23 -fmodules -O2 test.cc ``` Error message: ``` /usr/bin/ld: /tmp/ccml92so.o: in function `std::format_error::~format_error()': test.cc:(.text._ZNSt12format_errorD2Ev[_ZNSt12format_errorD5Ev]+0x3): undefined reference to `vtable for std::format_error' /usr/bin/ld: /tmp/ccml92so.o: in function `std::__throw_format_error(char const*)': test.cc:(.text.unlikely._ZSt20__throw_format_errorPKc[_ZSt20__throw_format_errorPKc]+0x21): undefined reference to `vtable for std::format_error' /usr/bin/ld: /tmp/ccml92so.o: in function `std::format_error::~format_error()': test.cc:(.text._ZNSt12format_errorD0Ev[_ZNSt12format_errorD5Ev]+0x7): undefined reference to `vtable for std::format_error' /usr/bin/ld: /tmp/ccml92so.o: in function `main.cold': test.cc:(.text.unlikely+0x2f): undefined reference to `vtable for std::__format::_Seq_sink<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >' /usr/bin/ld: test.cc:(.text.unlikely+0x85): undefined reference to `vtable for std::__format::_Seq_sink<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >' /usr/bin/ld: /tmp/ccml92so.o: in function `.LC25': test.cc:(.rodata.cst8+0x0): undefined reference to `vtable for std::__format::_Seq_sink<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >' /usr/bin/ld: /tmp/ccml92so.o: in function `.LC26': test.cc:(.rodata.cst8+0x8): undefined reference to `vtable for std::__format::_Formatting_scanner<std::__format::_Sink_iter<char>, char>' collect2: error: ld returned 1 exit status ``` Bisection points to https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c875748cdc468ec604c904e19a688998aa4d7a1f. `gcc -v`: ``` Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/home/cyano/gcc-git/bin/../libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc/configure --prefix= --enable-languages=c,c++ --enable-static --disable-shared --disable-bootstrap --disable-multilib CFLAGS=-O2 CXXFLAGS=-O2 LDFLAGS=-s Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 16.0.0 20250516 (experimental) (GCC) ```