This reverts commit
r16-63-g241157eb0858b3. It turns out that the
'lazy_load_pendings' is necessary if we haven't seen a binding for the
given template name at all in the current TU, as it is also used to find
template instantiations with the given name.
gcc/cp/ChangeLog:
* name-lookup.cc (lookup_imported_hidden_friend): Add back
lazy_load_pendings with comment.
gcc/testsuite/ChangeLog:
* g++.dg/modules/tpl-friend-19_a.C: New test.
* g++.dg/modules/tpl-friend-19_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
|| !DECL_MODULE_ENTITY_P (inner))
return NULL_TREE;
+ /* Load any templates matching FRIEND_TMPL from importers. */
+ lazy_load_pendings (friend_tmpl);
+
tree name = DECL_NAME (inner);
tree *slot = find_namespace_slot (current_namespace, name, false);
if (!slot || !*slot || TREE_CODE (*slot) != BINDING_VECTOR)
--- /dev/null
+// { dg-additional-options "-fmodules -Wno-global-module" }
+// { dg-module-cmi M }
+
+module;
+
+template <typename _MemFunPtr>
+class _Mem_fn_base {
+ template <typename> friend struct _Bind_check_arity;
+};
+
+template <typename> struct _Bind_check_arity {};
+
+export module M;
+
+template struct _Bind_check_arity<int>;
+export _Mem_fn_base<int> mem_fn();
--- /dev/null
+// { dg-additional-options "-fmodules" }
+
+import M;
+int main() {
+ mem_fn();
+}