C++ Logo

std-discussion

Advanced search

Re: Attaching a declaration

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 16 Feb 2022 17:34:37 -0500
On Wed, Feb 16, 2022 at 2:43 PM Vladimir Grigoriev via Std-Discussion
<std-discussion_at_[hidden]> wrote:
>
> The p. # 7 in the section «10.1 Module units and purviews» says if it
> (7.1.2) — is a namespace-definition with external linkage,
> it is attached to the global module.
>
> So if you have
>
> export module A;
> namespace N1
> {
> int x;
> }
>
> or
>
> export module A;
> export namespace N1
> {
> int x;
> }
>
> when is the namespace definition N1 attached to the global module (because it has external linkage) or to the purview of the module A?

Namespaces have external linkage if they are not unnamed or are not in
an unnamed namespace. All such namespaces are therefore part of the
global module.

I don't see what is confusing here.

Received on 2022-02-16 22:34:49