It looks to me as if the text in section 10.3 itself is actively inviting that kind of confusion.  For example, the note 4 says


[Note 4: A module-import-declaration nominating a header-name is also recognized by the preprocessor, and results in macros defined at the end of phase 4 of translation of the header unit being made visible as described in [cpp.import]. Any other module-import-declaration does not make macros visible. — end note]


How can a module-import-declaration be recognized by the preprocessor?  Which production makes that possible?


-- Gaby


From: SG15 <sg15-bounces@lists.isocpp.org> On Behalf Of Richard Smith via SG15
Sent: Friday, December 16, 2022 11:42 AM
To: C++ Core Language Working Group <core@lists.isocpp.org>
Cc: Richard Smith <richardsmith@google.com>; sg15@lists.isocpp.org
Subject: Re: [SG15] [isocpp-core] Named modules, macros, and re-exporting header units


On Fri, Dec 16, 2022, 10:23 Ville Voutilainen via Core <core@lists.isocpp.org> wrote:

On Fri, 16 Dec 2022 at 20:21, Gabriel Dos Reis via SG15
<sg15@lists.isocpp.org> wrote:
> Exactly why we need to clarify the normative text to say explicitly that importing a named module does not bring in any macro even if the nominated module re-exported a header unit which might bring in macros if imported directly.  Even if we believe there is a (long) chain of inference to arrive there, it is better to have an explicit normative text to that effect.

Agreed, having an import of a named module bring in a macro is
unhinged, and must be rectified via any means.


We already have explicit normative text that says the right thing, but given that an implementer has read it and misunderstood, it seems like it's not clear enough and that rules describing phase 7 of translation are being incorrectly applied in phase 4 as well. We should probably reiterate that the rules in the preprocessor section define the behaviour of phase 4 of translation and the rules elsewhere do not, and what that means for macro imports in particular. A couple of well-placed notes or examples seem well-suited for this purpose to me.


Core mailing list
Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/core
Link to this post: http://lists.isocpp.org/core/2022/12/13659.php