Skip to content

Commit f7a9b2b

Browse files
authored
Merge 2019-07 CWG Motion 24
P1703R1 Recognizing header unit imports requires full preprocessing Fixes #3003.
2 parents fc62568 + 6b6b656 commit f7a9b2b

File tree

4 files changed

+117
-127
lines changed

4 files changed

+117
-127
lines changed

source/basic.tex

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -815,9 +815,12 @@
815815

816816
\rSec2[basic.scope.pdecl]{Point of declaration}
817817

818+
\indextext{declaration!point of|(}%
819+
818820
\pnum
819-
\indextext{name!point of declaration}%
820-
The \defn{point of declaration} for a name is immediately after its
821+
\indextext{name!point of declaration|see{declaration, point of}}%
822+
\indextext{point of!declaration|see{declaration, point of}}%
823+
The \defnx{point of declaration}{declaration!point of} for a name is immediately after its
821824
complete declarator\iref{dcl.decl} and before its
822825
\grammarterm{initializer} (if any), except as noted below. \begin{example}
823826

@@ -963,9 +966,11 @@
963966
\end{note}
964967

965968
\pnum
966-
\begin{note} For point of instantiation of a template,
967-
see~\ref{temp.point}.\end{note}%
969+
\begin{note}
970+
For point of instantiation of a template, see~\ref{temp.point}.
971+
\end{note}
968972
\indextext{scope!declarations and|)}
973+
\indextext{declaration!point of|)}
969974

970975
\rSec2[basic.scope.block]{Block scope}
971976

@@ -2590,8 +2595,7 @@
25902595

25912596
\pnum
25922597
A token sequence beginning with
2593-
\opt{\tcode{export}} \tcode{module} or
2594-
\opt{\tcode{export}} \tcode{import}
2598+
\opt{\tcode{export}} \tcode{module}
25952599
and not immediately followed by \tcode{::}
25962600
is never interpreted as the \grammarterm{declaration}
25972601
of a \grammarterm{top-level-declaration}.

source/lex.tex

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@
273273
\begin{bnf}
274274
\nontermdef{preprocessing-token}\br
275275
header-name\br
276+
import-keyword\br
276277
identifier\br
277278
pp-number\br
278279
character-literal\br
@@ -338,17 +339,13 @@
338339
except that a \grammarterm{header-name}\iref{lex.header} is only formed
339340
\begin{itemize}
340341
\item
341-
within a \tcode{\#include} directive\iref{cpp.include},
342+
after the \tcode{include} or \tcode{import} preprocessing token in an
343+
\tcode{\#include}\iref{cpp.include} or
344+
\tcode{import}\iref{cpp.import} directive, or
342345

343346
\item
344-
within a \grammarterm{has-include-expression}, or
347+
within a \grammarterm{has-include-expression}.
345348

346-
\item
347-
outside of any preprocessing directive,
348-
if applying phase 4 of translation to the sequence
349-
of preprocessing tokens produced thus far
350-
is valid and
351-
results in an \grammarterm{import-seq}\iref{cpp.module}.
352349
\end{itemize}
353350
\end{itemize}
354351

@@ -359,6 +356,11 @@
359356
\end{codeblock}
360357
\end{example}
361358

359+
\pnum
360+
The \grammarterm{import-keyword} is produced
361+
by processing an \tcode{import} directive\iref{cpp.import} and
362+
has no associated grammar productions.
363+
362364
\pnum
363365
\begin{example} The program fragment \tcode{0xe+foo} is parsed as a
364366
preprocessing number token (one that is not a valid floating or integer

source/modules.tex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@
411411

412412
\begin{bnf}
413413
\nontermdef{module-import-declaration}\br
414-
\opt{\keyword{export}} \keyword{import} module-name \opt{attribute-specifier-seq} \terminal{;}\br
415-
\opt{\keyword{export}} \keyword{import} module-partition \opt{attribute-specifier-seq} \terminal{;}\br
416-
\opt{\keyword{export}} \keyword{import} header-name \opt{attribute-specifier-seq} \terminal{;}
414+
\opt{\keyword{export}} import-keyword module-name \opt{attribute-specifier-seq} \terminal{;}\br
415+
\opt{\keyword{export}} import-keyword module-partition \opt{attribute-specifier-seq} \terminal{;}\br
416+
\opt{\keyword{export}} import-keyword header-name \opt{attribute-specifier-seq} \terminal{;}
417417
\end{bnf}
418418

419419
\pnum
@@ -478,7 +478,7 @@
478478
a \grammarterm{header-name} is also recognized by the
479479
preprocessor, and results in macros defined at the
480480
end of phase 4 of translation of the header unit
481-
being made visible as described in \ref{cpp.module}.
481+
being made visible as described in \ref{cpp.import}.
482482
\end{note}
483483
A declaration of a name with internal linkage is
484484
permitted within a header unit despite all

0 commit comments

Comments
 (0)