]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Avoid ICE when redefining a type reachable via import [PR122053]
authorNathaniel Shead <nathanieloshead@gmail.com>
Fri, 26 Sep 2025 12:10:15 +0000 (22:10 +1000)
committerNathaniel Shead <nathanieloshead@gmail.com>
Sun, 5 Oct 2025 10:37:33 +0000 (21:37 +1100)
commitfa6544ef5f50a824cabeda4906453d4545fbf66f
treee3910f64188529b79d208d4ffdab7856ef9a204b
parent000cde096d2f60b968890f3075e839bf19c7f4a2
c++/modules: Avoid ICE when redefining a type reachable via import [PR122053]

This shouldn't be an error (see PR c++/99000), but we can at least avoid
the ICE by ensuring that we load any pending type definition before
calling pushdecl, so that we error before committing to filling in the
class definition.

Something like this will probably still be helpful even for implementing
textual deduplication as we now at least ensure check_module_override is
called for this case.

PR c++/122053

gcc/cp/ChangeLog:

* name-lookup.cc (pushtag): Load any imported definition of type
before calling pushdecl.

gcc/testsuite/ChangeLog:

* g++.dg/modules/pr122053_a.C: New test.
* g++.dg/modules/pr122053_b.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
gcc/cp/name-lookup.cc
gcc/testsuite/g++.dg/modules/pr122053_a.C [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr122053_b.C [new file with mode: 0644]