Hi GCC, I've been trying to compile our projects with modules. I stumbled upon a Non-Type Template Parameter Pack, which results in the errors: "recursive lazy load" "failed to load pendings for" Originally found in https://github.com/getml/reflect-cpp/ Specifically in https://github.com/getml/reflect-cpp/blob/main/include/rfl/Literal.hpp#L25 I attached a small example. It works with Clang-18 and Clang-19, but fails with GCC-14 (g++ (Debian 14.2.0-8) 14.2.0 ) Is it a bug in GCC? Or a missing feature? Can I adjust something to make it work? Thanks. Best regards, Manuel
# $ cmake -B build -S . -G Ninja -D CMAKE_EXPORT_COMPILE_COMMANDS=ON --fresh cmake_minimum_required(VERSION 3.30) project(modules) add_executable(modules main.cpp) target_compile_features(modules PRIVATE cxx_std_23) target_compile_options( modules PRIVATE -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always ) target_sources( modules PRIVATE PUBLIC FILE_SET CXX_MODULES FILES module1.ixx )
import module1; auto main() -> int { auto module1 = Module1{}; return 0; }
Attachment:
module1.ixx
Description: Binary data
Change Dir: '/home/manuel/Projects/experiments/gcc_modules_pendings/build_gcc14' Run Clean Command: /usr/bin/ninja -v clean [1/1] /usr/bin/ninja -t clean Cleaning... 10 files. Run Build Command(s): /usr/bin/ninja -v [1/6] /usr/bin/c++ -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -E -x c++ /home/manuel/Projects/experiments/gcc_modules_pendings/module1.ixx -MT CMakeFiles/modules.dir/module1.ixx.o.ddi -MD -MF CMakeFiles/modules.dir/module1.ixx.o.ddi.d -fmodules-ts -fdeps-file=CMakeFiles/modules.dir/module1.ixx.o.ddi -fdeps-target=CMakeFiles/modules.dir/module1.ixx.o -fdeps-format=p1689r5 -o CMakeFiles/modules.dir/module1.ixx.o.ddi.i [2/6] /usr/bin/c++ -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -E -x c++ /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp -MT CMakeFiles/modules.dir/main.cpp.o.ddi -MD -MF CMakeFiles/modules.dir/main.cpp.o.ddi.d -fmodules-ts -fdeps-file=CMakeFiles/modules.dir/main.cpp.o.ddi -fdeps-target=CMakeFiles/modules.dir/main.cpp.o -fdeps-format=p1689r5 -o CMakeFiles/modules.dir/main.cpp.o.ddi.i [3/6] /usr/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/modules.dir/CXXDependInfo.json --lang=CXX --modmapfmt=gcc --dd=CMakeFiles/modules.dir/CXX.dd @CMakeFiles/modules.dir/CXX.dd.rsp [4/6] /usr/bin/c++ -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -MD -MT CMakeFiles/modules.dir/module1.ixx.o -MF CMakeFiles/modules.dir/module1.ixx.o.d -fmodules-ts -fmodule-mapper=CMakeFiles/modules.dir/module1.ixx.o.modmap -MD -fdeps-format=p1689r5 -x c++ -o CMakeFiles/modules.dir/module1.ixx.o -c /home/manuel/Projects/experiments/gcc_modules_pendings/module1.ixx [5/6] /usr/bin/c++ -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -MD -MT CMakeFiles/modules.dir/main.cpp.o -MF CMakeFiles/modules.dir/main.cpp.o.d -fmodules-ts -fmodule-mapper=CMakeFiles/modules.dir/main.cpp.o.modmap -MD -fdeps-format=p1689r5 -x c++ -o CMakeFiles/modules.dir/main.cpp.o -c /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp FAILED: CMakeFiles/modules.dir/main.cpp.o /usr/bin/c++ -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -MD -MT CMakeFiles/modules.dir/main.cpp.o -MF CMakeFiles/modules.dir/main.cpp.o.d -fmodules-ts -fmodule-mapper=CMakeFiles/modules.dir/main.cpp.o.modmap -MD -fdeps-format=p1689r5 -x c++ -o CMakeFiles/modules.dir/main.cpp.o -c /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp:4:20: error: recursive lazy load 4 | auto module1 = Module1{}; | ^~~~~~~ /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp:4:20: fatal error: failed to load pendings for ‘::S’ compilation terminated. ninja: build stopped: subcommand failed.
Change Dir: '/home/manuel/Projects/experiments/gcc_modules_pendings/build_clang18' Run Clean Command: /usr/bin/ninja -v clean [1/1] /usr/bin/ninja -t clean Cleaning... 12 files. Run Build Command(s): /usr/bin/ninja -v [1/6] "/usr/bin/clang-scan-deps-18" -format=p1689 -- /usr/bin/clang++-18 -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -x c++ /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp -c -o CMakeFiles/modules.dir/main.cpp.o -resource-dir "/usr/lib/llvm-18/lib/clang/18" -MT CMakeFiles/modules.dir/main.cpp.o.ddi -MD -MF CMakeFiles/modules.dir/main.cpp.o.ddi.d > CMakeFiles/modules.dir/main.cpp.o.ddi.tmp && mv CMakeFiles/modules.dir/main.cpp.o.ddi.tmp CMakeFiles/modules.dir/main.cpp.o.ddi [2/6] "/usr/bin/clang-scan-deps-18" -format=p1689 -- /usr/bin/clang++-18 -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -x c++ /home/manuel/Projects/experiments/gcc_modules_pendings/module1.ixx -c -o CMakeFiles/modules.dir/module1.ixx.o -resource-dir "/usr/lib/llvm-18/lib/clang/18" -MT CMakeFiles/modules.dir/module1.ixx.o.ddi -MD -MF CMakeFiles/modules.dir/module1.ixx.o.ddi.d > CMakeFiles/modules.dir/module1.ixx.o.ddi.tmp && mv CMakeFiles/modules.dir/module1.ixx.o.ddi.tmp CMakeFiles/modules.dir/module1.ixx.o.ddi [3/6] /usr/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/modules.dir/CXXDependInfo.json --lang=CXX --modmapfmt=clang --dd=CMakeFiles/modules.dir/CXX.dd @CMakeFiles/modules.dir/CXX.dd.rsp [4/6] /usr/bin/clang++-18 -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -MD -MT CMakeFiles/modules.dir/module1.ixx.o -MF CMakeFiles/modules.dir/module1.ixx.o.d @CMakeFiles/modules.dir/module1.ixx.o.modmap -o CMakeFiles/modules.dir/module1.ixx.o -c /home/manuel/Projects/experiments/gcc_modules_pendings/module1.ixx [5/6] /usr/bin/clang++-18 -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -MD -MT CMakeFiles/modules.dir/main.cpp.o -MF CMakeFiles/modules.dir/main.cpp.o.d @CMakeFiles/modules.dir/main.cpp.o.modmap -o CMakeFiles/modules.dir/main.cpp.o -c /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp:4:10: warning: unused variable 'module1' [-Wunused-variable] 4 | auto module1 = Module1{}; | ^~~~~~~ 1 warning generated. [6/6] : && /usr/bin/clang++-18 -Xlinker --dependency-file -Xlinker CMakeFiles/modules.dir/link.d CMakeFiles/modules.dir/main.cpp.o CMakeFiles/modules.dir/module1.ixx.o -o modules && :
Change Dir: '/home/manuel/Projects/experiments/gcc_modules_pendings/build_clang19' Run Clean Command: /usr/bin/ninja -v clean [1/1] /usr/bin/ninja -t clean Cleaning... 12 files. Run Build Command(s): /usr/bin/ninja -v [1/6] "/usr/bin/clang-scan-deps-19" -format=p1689 -- /usr/bin/clang++-19 -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -x c++ /home/manuel/Projects/experiments/gcc_modules_pendings/module1.ixx -c -o CMakeFiles/modules.dir/module1.ixx.o -resource-dir "/usr/lib/llvm-19/lib/clang/19" -MT CMakeFiles/modules.dir/module1.ixx.o.ddi -MD -MF CMakeFiles/modules.dir/module1.ixx.o.ddi.d > CMakeFiles/modules.dir/module1.ixx.o.ddi.tmp && mv CMakeFiles/modules.dir/module1.ixx.o.ddi.tmp CMakeFiles/modules.dir/module1.ixx.o.ddi [2/6] "/usr/bin/clang-scan-deps-19" -format=p1689 -- /usr/bin/clang++-19 -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -x c++ /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp -c -o CMakeFiles/modules.dir/main.cpp.o -resource-dir "/usr/lib/llvm-19/lib/clang/19" -MT CMakeFiles/modules.dir/main.cpp.o.ddi -MD -MF CMakeFiles/modules.dir/main.cpp.o.ddi.d > CMakeFiles/modules.dir/main.cpp.o.ddi.tmp && mv CMakeFiles/modules.dir/main.cpp.o.ddi.tmp CMakeFiles/modules.dir/main.cpp.o.ddi [3/6] /usr/bin/cmake -E cmake_ninja_dyndep --tdi=CMakeFiles/modules.dir/CXXDependInfo.json --lang=CXX --modmapfmt=clang --dd=CMakeFiles/modules.dir/CXX.dd @CMakeFiles/modules.dir/CXX.dd.rsp [4/6] /usr/bin/clang++-19 -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -MD -MT CMakeFiles/modules.dir/module1.ixx.o -MF CMakeFiles/modules.dir/module1.ixx.o.d @CMakeFiles/modules.dir/module1.ixx.o.modmap -o CMakeFiles/modules.dir/module1.ixx.o -c /home/manuel/Projects/experiments/gcc_modules_pendings/module1.ixx [5/6] /usr/bin/clang++-19 -std=gnu++23 -Wall -Wextra -pedantic -O0 -g3 -ggdb -fdiagnostics-color=always -MD -MT CMakeFiles/modules.dir/main.cpp.o -MF CMakeFiles/modules.dir/main.cpp.o.d @CMakeFiles/modules.dir/main.cpp.o.modmap -o CMakeFiles/modules.dir/main.cpp.o -c /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp /home/manuel/Projects/experiments/gcc_modules_pendings/main.cpp:4:10: warning: unused variable 'module1' [-Wunused-variable] 4 | auto module1 = Module1{}; | ^~~~~~~ 1 warning generated. [6/6] : && /usr/bin/clang++-19 -Xlinker --dependency-file -Xlinker CMakeFiles/modules.dir/link.d CMakeFiles/modules.dir/main.cpp.o CMakeFiles/modules.dir/module1.ixx.o -o modules && :