inline bool named_module_purview_p ()
{ return named_module_p () && module_purview_p (); }
+inline bool named_module_attach_p ()
+{ return named_module_p () && module_attach_p (); }
/* We're currently exporting declarations. */
inline bool module_exporting_p ()
{
/* A function-scope decl of some namespace-scope decl. */
DECL_LOCAL_DECL_P (decl) = true;
- if (named_module_purview_p ())
+ if (named_module_attach_p ())
error_at (declarator->id_loc,
- "block-scope extern declaration %q#D not permitted"
- " in module purview", decl);
+ "block-scope extern declaration %q#D must not be"
+ " attached to a named module", decl);
}
/* Enter this declaration into the symbol table. Don't push the plain
check_template_shadow (fndecl);
/* p1779 ABI-Isolation makes inline not a default for in-class
- definitions in named module purview. If the user explicitly
+ definitions attached to a named module. If the user explicitly
made it inline, grokdeclarator will already have done the right
things. */
- if ((!named_module_purview_p ()
+ if ((!named_module_attach_p ()
|| flag_module_implicit_inline
/* Lambda's operator function remains inline. */
|| LAMBDA_TYPE_P (DECL_CONTEXT (fndecl)))
--- /dev/null
+// { dg-additional-options "-fmodules-ts" }
+// { dg-module-cmi bla }
+
+export module bla;
+
+export extern "C++" inline void fun() {
+ void oops(); // { dg-bogus "block-scope extern declaration" }
+ oops();
+}
--- /dev/null
+// { dg-additional-options "-fmodules-ts" }
+// { dg-module-cmi !mod }
+
+export module mod;
+
+namespace {
+ void internal() {}
+}
+
+export extern "C++" auto foo() {
+ struct X {
+ // `foo` is not attached to a named module, and as such
+ // `X::f` should be implicitly `inline` here
+ void f() { // { dg-error "references internal linkage entity" }
+ internal();
+ }
+ };
+ return X{};
+}
+
+// { dg-prune-output "failed to write compiled module" }