https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129264

            Bug ID: 129264
           Summary: [16 Regression] [modules] "recursive lazy load" when
                    an imported class contains a pointer to an array of an
                    incomplete class template specialization
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bas.van.dijk at cern dot ch
  Target Milestone: ---

An exported alias template whose class refers to a pointer to an array of
unknown bound of a class template specialization that is still incomplete when
the pointer is declared. The module builds fine, but the importer fails with
"recursive lazy load". GCC 14.x and 15.1.0 accept it. 16.1.0 reject it.

-------------------------------------------------
// m.cppm
export module m;
export template <typename> struct A;
struct T { A<char> (*p)[]; };
template <typename> struct A { T t; };
-------------------------------------------------
// t.cpp
import m;
int main() { A<int> a; (void)a; }
-------------------------------------------------

$ g++ -std=c++20 -fmodules-ts -x c++ -c m.cppm -o m.o
$ g++ -std=c++20 -fmodules-ts -fsyntax-only t.cpp

src/t.cpp: In function 'int main()':
src/t.cpp:2:14: error: recursive lazy load
    2 | int main() { A<int> a; (void)a; }
      |              ^
src/t.cpp:2:14: fatal error: failed to load pendings for '::A'
compilation terminated.

(-fmodules-ts works the same on GCC 14, 15 and 16.)

Results with release builds (conda-forge) and a trunk build:

14.3.0 (CERN LCG build, 14.3.0-c8dfb): OK.  14.4.0 (conda-forge): OK.  15.2.0
(CERN LCG build, 15.2.0-35657): OK. 16.1.0 (conda-forge, and CERN LCG build
16.1.0-43042): error.

Reply via email to