27_io/headers/iostream/synopsis.cc was failing with modules because pushdecl
called update_binding for a redeclared import while passing the built-in
clog as "old". This could also be fixed by discarding the builtin in
e.g. import_module_binding, but this seems straightforward.
gcc/cp/ChangeLog:
* name-lookup.cc (pushdecl): Discard built-in sooner.
gcc/testsuite/ChangeLog:
* g++.dg/modules/builtin-9_a.C: New test.
* g++.dg/modules/builtin-9_b.C: New test.
}
}
+ /* Skip a hidden builtin we failed to match already. There can
+ only be one. */
+ if (old && anticipated_builtin_p (old))
+ old = OVL_CHAIN (old);
+
/* Check for redeclaring an import. */
if (slot && *slot && TREE_CODE (*slot) == BINDING_VECTOR)
if (tree match
/* We are pushing a new decl. */
- /* Skip a hidden builtin we failed to match already. There can
- only be one. */
- if (old && anticipated_builtin_p (old))
- old = OVL_CHAIN (old);
-
if (hiding)
; /* Hidden bindings don't shadow anything. */
else
--- /dev/null
+// Test that the built-in clog doesn't interfere with redeclaring the import.
+
+// { dg-additional-options "-fmodules -Wno-global-module" }
+
+module;
+
+namespace std {
+ class ostream;
+ extern ostream clog;
+}
+
+export module M;
+
+namespace std {
+ export using std::clog;
+}
--- /dev/null
+// { dg-additional-options -fmodules }
+
+import M;
+
+namespace std {
+ class ostream;
+ extern ostream clog;
+}