Tested x86_64-pc-linux-gnu, applying to trunk.
-- 8< --
This was fixed by the pushdecl hunk of r17-4959 (PR99000).
PR c++/122774
gcc/testsuite/ChangeLog:
* g++.dg/modules/gmf-7_a.C: New test.
* g++.dg/modules/gmf-7_b.C: New test.
---
gcc/testsuite/g++.dg/modules/gmf-7_a.C | 5 +++++
gcc/testsuite/g++.dg/modules/gmf-7_b.C | 5 +++++
2 files changed, 10 insertions(+)
create mode 100644 gcc/testsuite/g++.dg/modules/gmf-7_a.C
create mode 100644 gcc/testsuite/g++.dg/modules/gmf-7_b.C
diff --git a/gcc/testsuite/g++.dg/modules/gmf-7_a.C
b/gcc/testsuite/g++.dg/modules/gmf-7_a.C
new file mode 100644
index 00000000000..21db8a44594
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/gmf-7_a.C
@@ -0,0 +1,5 @@
+// PR c++/122774
+// { dg-additional-options "-fmodules" }
+
+export module M;
+export extern "C" int scanf(const char *, ...);
diff --git a/gcc/testsuite/g++.dg/modules/gmf-7_b.C
b/gcc/testsuite/g++.dg/modules/gmf-7_b.C
new file mode 100644
index 00000000000..18f79a42b76
--- /dev/null
+++ b/gcc/testsuite/g++.dg/modules/gmf-7_b.C
@@ -0,0 +1,5 @@
+// { dg-additional-options "-fmodules" }
+import M;
+extern "C" int scanf(const char *, ...);
+int scanf(const char *, ...);
+using ::scanf;
base-commit: 7f584c03680269506a5ff5492f1366a431719346
prerequisite-patch-id: 58768bd082750b6e1c6ebbdaedd9806370178189
--
2.55.0