<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2732</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="2732"></A><H4>2732.
  
Can importable headers react to preprocessor state from point of import?
</H4>
<B>Section: </B>10.3&#160; [<A href="https://wg21.link/module.import">module.import</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD7
 &#160;&#160;&#160;

 <B>Submitter: </B>Xu Chuanqi
 &#160;&#160;&#160;

 <B>Date: </B>2023-05-25<BR>


<P>[Accepted as a DR at the June, 2023 meeting.]</P>



<P>Subclause 10.3 [<A href="https://wg21.link/module.import#5">module.import</A>] paragraph 5 specifies:</P>

<BLOCKQUOTE>

A <I>module-import-declaration</I> that specifies a <I>header-name</I>
H imports a synthesized header unit, which is a translation unit
formed by applying phases 1 to 7 of translation
(5.2 [<A href="https://wg21.link/lex.phases">lex.phases</A>]) to the source file or header nominated by
H, which shall not contain a <I>module-declaration</I>.

[<I>Note 2:</I> All declarations within a header unit are implicitly
exported (10.2 [<A href="https://wg21.link/module.interface">module.interface</A>]), and are attached to the global
module (10.1 [<A href="https://wg21.link/module.unit">module.unit</A>]). &#8212;<I>end note</I>]

</BLOCKQUOTE>

<P>It is unclear whether the contents of header units can vary
depending on the set of defined macros at the point where
the <TT>import</TT> (or <TT>#include</TT>) appears.</P>

<P><B>Proposed resolution (approved by CWG 2023-06-13):</B></P>

<P>Change in 10.3 [<A href="https://wg21.link/module.import#5">module.import</A>] paragraph 5 as follows:</P>

<BLOCKQUOTE>

[<I>Note 2:</I>
<INS>A header unit is a separate translation unit with an
independent set of defined macros.</INS> All declarations within a
header unit are implicitly exported (10.2 [<A href="https://wg21.link/module.interface">module.interface</A>]), and
are attached to the global module
(10.1 [<A href="https://wg21.link/module.unit">module.unit</A>]). &#8212;<I>end note</I>]

</BLOCKQUOTE>

<BR><BR>
</BODY>
</HTML>
