https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125635
Bug ID: 125635
Summary: [modules] failed to load pendings for
std::__cxx11::list after unused module import
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: ulf.iversen at gmail dot com
Target Milestone: ---
Note: I don't know if this is an issue with gcc or libstdc++, I've tagged
libstdc++ because std::list fails.
Some containers work and some doesn't, which is the reasons I believe this is a
bug in GCC.
I've tried to minimize it as much as possible. This is the best I can currently
do.
g.objects.cppm
```
module;
#include <list>
export module gc.objects;
export class Object {
public:
virtual ~Object() = default;
};
export class Value {
};
export using LpValueVector = std::list<Value>;
```
gc.core.cppm
```
module;
#include <list>
export module gc.core;
import gc.objects;
//if List::m_items and m_stack both have LpValueVector or std::list it works
struct Vm {
std::list<Value> m_stack;
};
```
gc.types.cppm
```
module;
#include <list>
export module gc.types;
import gc.objects;
// Unused import, must be present for failure.
import gc.core;
// Must inherit from Object
struct List final : Object {
LpValueVector m_items;
};
```
lisp.reader.cppm
```
module;
#include <list>
export module lisp.reader;
import gc.types;
export class Token {};
export using ReaderTokenVector = std::list<Token>;
```
---
Compiled with:
mkdir build && cd build
g++-16 -std=c++26 -fmodules-ts -x c++ -c ../gc.objects.cppm -o gc.objects.o
g++-16 -std=c++26 -fmodules-ts -x c++ -c ../gc.core.cppm -o gc.core.o
g++-16 -std=c++26 -fmodules-ts -x c++ -c ../gc.types.cppm -o gc.types.o
g++-16 -std=c++26 -fmodules-ts -x c++ -c ../lisp.reader.cppm -o lisp.reader.o
In module imported at ../lisp.reader.cppm:7:1:
gc.types: error: failed to read compiled module cluster 804: Bad file data
gc.types: note: compiled module file is ‘gcm.cache/gc.types.gcm’
../lisp.reader.cppm:11:49: fatal error: failed to load pendings for
‘std::__cxx11::list’
11 | export using ReaderTokenVector = std::list<Token>;
| ^
compilation terminated.
---
g++-16 -v
Using built-in specs.
COLLECT_GCC=g++-16
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/16/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
16-20260322-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-16/README.Bugs
--enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust,cobol,algol68
--prefix=/usr --with-gcc-major-version-only --program-suffix=-16
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--enable-default-pie --with-system-zlib --enable-libphobos-checking=release
--with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch
--disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-16-UBzkgO/gcc-16-16-20260322/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-16-UBzkgO/gcc-16-16-20260322/debian/tmp-gcn/usr
--enable-offload-defaulted --without-cuda-driver --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
--with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.1 20260322 (experimental) [trunk r16-8246-g569ace1fa50]
(Ubuntu 16-20260322-1ubuntu1)
---
I've tested a few different containers:
std::list fails
std::vector fails
std::forward_list fails
std::deqeue works
std::set works
std::flat_set works
std::stack works
std::queue works
std::multiset works
std::priority_queue works
Interestingly std::pmr::list also works!
List gc.types.cppm must inherit from Object for it to fail. Removing `: Object`
makes the code compile.
(Workaround) Removing the unused import gc.core from gc.types.cppm makes the
code compile.
(Workaround) If struct List and struct Vm both use LpValueVector or
std::list<Value> it compiles, but if one if LpValueVector and one is
std::vector<Value> it works.