diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 001430a4a8f..d94d8ff4df9 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -13090,7 +13090,7 @@ depset::hash::add_binding_entity (tree decl, WMB_Flags flags, void *data_) inner = DECL_TEMPLATE_RESULT (inner); if ((!DECL_LANG_SPECIFIC (inner) || !DECL_MODULE_PURVIEW_P (inner)) - && !(flags & (WMB_Using | WMB_Export))) + && !((flags & WMB_Using) && (flags & WMB_Export))) /* Ignore global module fragment entities unless explicitly exported with a using declaration. */ return false; diff --git a/gcc/testsuite/g++.dg/modules/using-14.C b/gcc/testsuite/g++.dg/modules/using-14.C new file mode 100644 index 00000000000..0e15a952de5 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/using-14.C @@ -0,0 +1,14 @@ +// PR c++/114600 +// { dg-additional-options "-fmodules-ts -Wno-global-module -fdump-lang-module" } +// { dg-module-cmi M } + +module; +namespace std { + template struct A { int n; }; + template A f(); + namespace __swappable_details { using std::f; } +} +export module M; + +// The whole GMF should be discarded here +// { dg-final { scan-lang-dump "Wrote 0 clusters" module } }