[gcc r16-5829] c++/modules: Remove incorrect is_import check in using-directives

Nathaniel Shead nshead@gcc.gnu.org
Tue Dec 2 11:14:27 GMT 2025


https://gcc.gnu.org/g:58305f56176bb1f1f1050211e42eff0056ac1c9c

commit r16-5829-g58305f56176bb1f1f1050211e42eff0056ac1c9c
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Tue Dec 2 10:24:01 2025 +1100

    c++/modules: Remove incorrect is_import check in using-directives
    
    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>

Diff:
---
 gcc/cp/module.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc
index 042b029a036e..5c70e9bb4695 100644
--- a/gcc/cp/module.cc
+++ b/gcc/cp/module.cc
@@ -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;


More information about the Gcc-cvs mailing list