diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2023-11-12 11:54:43 +1100 |
---|---|---|
committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2023-12-17 10:38:35 +1100 |
commit | cb76f46c97e9f4e4869acceb77a000b6cc2cda0e (patch) | |
tree | a244dbfdbd022db5aa207436e43460519ff3f395 /gcc | |
parent | 7abc7aae564e63173fbaa14805e3dddea7f6a160 (diff) | |
download | gcc-cb76f46c97e9f4e4869acceb77a000b6cc2cda0e.zip gcc-cb76f46c97e9f4e4869acceb77a000b6cc2cda0e.tar.gz gcc-cb76f46c97e9f4e4869acceb77a000b6cc2cda0e.tar.bz2 |
c++: Seed namespaces for bindings [PR106363]
Currently the first depset for an EK_BINDING is not seeded. This breaks
the attached testcase as then the namespace is not considered referenced
yet during streaming, but we've already finished importing.
There doesn't seem to be any particular reason I could find for skipping
the first depset for bindings, and removing the condition doesn't appear
to cause any test failures, so this patch removes that check.
PR c++/106363
gcc/cp/ChangeLog:
* module.cc (module_state::write_cluster): Don't skip first
depset for bindings.
gcc/testsuite/ChangeLog:
* g++.dg/modules/pr106363_a.C: New test.
* g++.dg/modules/pr106363_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/module.cc | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/modules/pr106363_a.C | 9 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/modules/pr106363_b.C | 10 |
3 files changed, 20 insertions, 3 deletions
diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 1b57fbe..0bd4641 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -14761,9 +14761,7 @@ module_state::write_cluster (elf_out *to, depset *scc[], unsigned size, for (unsigned ix = 0; ix != size; ix++) { depset *b = scc[ix]; - for (unsigned jx = (b->get_entity_kind () == depset::EK_BINDING - || b->is_special ()) ? 1 : 0; - jx != b->deps.length (); jx++) + for (unsigned jx = b->is_special (); jx != b->deps.length (); jx++) { depset *dep = b->deps[jx]; diff --git a/gcc/testsuite/g++.dg/modules/pr106363_a.C b/gcc/testsuite/g++.dg/modules/pr106363_a.C new file mode 100644 index 0000000..c18d2ee --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr106363_a.C @@ -0,0 +1,9 @@ +// PR c++/106363 +// { dg-additional-options "-fmodules-ts" } +// { dg-module-cmi pr106363.a } + +export module pr106363.a; + +namespace ns { + export int x; +} diff --git a/gcc/testsuite/g++.dg/modules/pr106363_b.C b/gcc/testsuite/g++.dg/modules/pr106363_b.C new file mode 100644 index 0000000..0508c0d --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr106363_b.C @@ -0,0 +1,10 @@ +// PR c++/106363 +// { dg-additional-options "-fmodules-ts" } +// { dg-module-cmi pr106363.b } + +export module pr106363.b; +import pr106363.a; + +namespace ns { + export using ns::x; +} |