count += callback (btype, flags, data);
}
- bool hidden = STAT_DECL_HIDDEN_P (bind);
+ bool part_hidden = STAT_DECL_HIDDEN_P (bind);
for (ovl_iterator iter (MAYBE_STAT_DECL (STAT_DECL (bind)));
iter; ++iter)
{
if (iter.hidden_p ())
- hidden = true;
+ part_hidden = true;
gcc_checking_assert
- (!(hidden && DECL_IS_UNDECLARED_BUILTIN (*iter)));
+ (!(part_hidden && DECL_IS_UNDECLARED_BUILTIN (*iter)));
WMB_Flags flags = WMB_None;
if (maybe_dups)
flags = WMB_Flags (flags | WMB_Dups);
- if (decl_hidden)
+ if (part_hidden)
flags = WMB_Flags (flags | WMB_Hidden);
if (iter.using_p ())
{
flags = WMB_Flags (flags | WMB_Export);
}
count += callback (*iter, flags, data);
- hidden = false;
+ part_hidden = false;
}
}
}
--- /dev/null
+// { dg-additional-options "-fmodules-ts" }
+// { dg-module-cmi M:S }
+
+export module M:S;
+
+namespace foo {
+ // propagate hidden from partitions
+ export struct S {
+ friend void f(S);
+ };
+};
--- /dev/null
+// { dg-additional-options "-fmodules-ts" }
+import M;
+
+int main() {
+ // this should be hidden and fail
+ foo::f(foo::S{}); // { dg-error "cannot convert" }
+
+ // but these should be legal
+ foo::f(10);
+ f(foo::S{});
+}