]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++/modules: Remove incorrect is_import check in using-directives
authorNathaniel Shead <nathanieloshead@gmail.com>
Mon, 1 Dec 2025 23:24:01 +0000 (10:24 +1100)
committerNathaniel Shead <nathanieloshead@gmail.com>
Tue, 2 Dec 2025 11:14:02 +0000 (22:14 +1100)
When I wrote this check in r16-5811 I was thinking of checking if the
using-directive was imported, but this just checks if the target
namespace was imported, which is not what we want.  We don't build deps
to see if the using-directive itself was imported, so just remove the
check.  I haven't been able to come up with a testcase this breaks but
it still seems reasonable to adjust.

gcc/cp/ChangeLog:

* module.cc (module_state::write_using_directives): Correct
condition.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
gcc/cp/module.cc

index 042b029a036eed476466a32c6de1ae58449fff96..5c70e9bb469581b68100808b7e97132a448f2873 100644 (file)
@@ -17652,7 +17652,7 @@ module_state::write_using_directives (elf_out *to, depset::hash &table,
             have been walked earlier (PR c++/122915).  But importers will
             be able to just refer to the decl in that module unless it was
             a partition anyway, so we don't have anything to do here.  */
-         if (!target_dep || target_dep->is_import ())
+         if (!target_dep)
            {
              gcc_checking_assert (DECL_MODULE_IMPORT_P (udir));
              continue;