Skip to content

Commit 1f287e7

Browse files
committed
P1103R3 Merging Modules
[basic.lookup.argdep] Make missed "associated classes" -> "associated entities" change. Replaced comments indicating the start of a translation unit codeblock in examples with a title.
1 parent 6f34b05 commit 1f287e7

File tree

11 files changed

+1838
-120
lines changed

11 files changed

+1838
-120
lines changed

source/basic.tex

Lines changed: 306 additions & 67 deletions
Large diffs are not rendered by default.

source/classes.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2876,7 +2876,7 @@
28762876
A bit-field shall not be a static member.
28772877
\indextext{bit-field!type of}%
28782878
A bit-field shall have integral or enumeration type;
2879-
the bit-field attribute is not part of the type of the class member.
2879+
the bit-field semantic property is not part of the type of the class member.
28802880
The \grammarterm{constant-expression} shall be an integral constant expression
28812881
with a value greater than or equal to zero and
28822882
is called the \defn{width} of the bit-field.

source/compatibility.tex

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,6 +1791,20 @@
17911791

17921792
\rSec2[diff.cpp17.lex]{\ref{lex}: lexical conventions}
17931793

1794+
\diffref{lex.header}
1795+
\change \grammarterm{header-name} tokens are formed in more contexts.
1796+
\rationale Required for new features.
1797+
\effect When the identifier \tcode{import}
1798+
is followed by a \tcode{<} character,
1799+
a \grammarterm{header-name} token may be formed.
1800+
\begin{example}
1801+
\begin{codeblock}
1802+
template<typename> class import {};
1803+
import<int> f(); // ill-formed; previously well-formed
1804+
::import<int> g(); // OK
1805+
\end{codeblock}
1806+
\end{example}
1807+
17941808
\diffref{lex.key}
17951809
\change New keywords.
17961810
\rationale Required for new features.
@@ -1862,6 +1876,25 @@
18621876

18631877
\rSec2[diff.cpp17.basic]{\ref{basic}: basics}
18641878

1879+
\diffref{basic.link,module.unit,module.import}
1880+
\change New identifiers with special meaning.
1881+
\rationale Required for new features.
1882+
\effect Top-level declarations beginning with
1883+
\tcode{module} or \tcode{import} may
1884+
be either ill-formed or interpreted differently
1885+
in this International Standard.
1886+
\begin{example}
1887+
\begin{codeblock}
1888+
class module;
1889+
module *m1; // ill-formed; previously well-formed
1890+
::module *m2; // OK
1891+
1892+
class import {};
1893+
import j1; // was variable declaration; now \grammarterm{import-declaration}
1894+
::import j2; // variable declaration
1895+
\end{codeblock}
1896+
\end{example}
1897+
18651898
\diffref{intro.races}
18661899
\change Except for the initial release operation,
18671900
a release sequence consists solely of atomic read-modify-write operations.

source/declarations.tex

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
deduction-guide\br
2626
explicit-instantiation\br
2727
explicit-specialization\br
28+
export-declaration\br
2829
linkage-specification\br
2930
namespace-definition\br
3031
empty-declaration\br
@@ -1025,27 +1026,46 @@
10251026
been declared inline.
10261027

10271028
\pnum
1028-
An inline function or variable shall be defined in every translation unit in which
1029-
it is odr-used and shall have exactly the same definition in every
1030-
case\iref{basic.def.odr}.
1029+
If an inline function or variable
1030+
is odr-used in a translation unit,
1031+
a definition of it shall be reachable from the end of that translation unit,
1032+
and it shall have exactly the same definition
1033+
in every such translation unit\iref{basic.def.odr}.
10311034
\begin{note}
10321035
A call to the inline function or a use of the inline variable may be encountered before its definition
10331036
appears in the translation unit.
10341037
\end{note}
1035-
If the definition of a function or variable appears in a translation unit before its
1038+
If a definition of a function or variable is reachable
1039+
at the point of its
10361040
first declaration as inline, the program is ill-formed. If a function or variable
1037-
with external linkage is declared inline in one translation unit, it
1038-
shall be declared inline in all translation units in which it appears;
1039-
no diagnostic is required. An inline function or variable with external
1040-
linkage shall have the same address in all translation units.
1041+
with external or module linkage
1042+
is declared inline in one translation unit,
1043+
there shall be a reachable inline declaration
1044+
in all translation units in which it is declared;
1045+
no diagnostic is required.
1046+
An inline function or variable
1047+
with external or module linkage
1048+
shall have the same address in all translation units.
10411049
\begin{note}
10421050
A \tcode{static} local variable in an inline
1043-
function with external linkage always refers to the same object.
1051+
function with external or module linkage
1052+
always refers to the same object.
10441053
A type defined within the body of an inline
1045-
function with external linkage is the
1054+
function with external or module linkage is the
10461055
same type in every translation unit.
10471056
\end{note}
10481057

1058+
\pnum
1059+
An exported inline function or variable
1060+
shall be defined in the translation unit
1061+
containing its exported declaration,
1062+
outside the \grammarterm{private-module-fragment} (if any).
1063+
\begin{note}
1064+
There is no restriction on the linkage (or absence thereof)
1065+
of entities that the function body of an exported inline function
1066+
can reference. A constexpr function\iref{dcl.constexpr} is implicitly inline.
1067+
\end{note}
1068+
10491069
\rSec2[dcl.type]{Type specifiers}%
10501070
\indextext{specifier!type|see{type specifier}}
10511071

@@ -1700,6 +1720,17 @@
17001720
\end{codeblock}
17011721
\end{example}
17021722

1723+
\pnum
1724+
An exported function
1725+
with a declared return type that uses a placeholder type
1726+
shall be defined in the translation unit
1727+
containing its exported declaration,
1728+
outside the \grammarterm{private-module-fragment} (if any).
1729+
\begin{note}
1730+
There is no restriction on the linkage of
1731+
the deduced return type.
1732+
\end{note}
1733+
17031734
\pnum
17041735
If the name of an entity with an undeduced placeholder type appears in an
17051736
expression, the program is ill-formed. Once a
@@ -6542,6 +6573,25 @@
65426573
the definition of a namespace can be split over several parts of one or
65436574
more translation units.
65446575

6576+
\pnum
6577+
\begin{note}
6578+
A namespace name with external linkage is exported
6579+
if any of its \term{namespace-definition}{s} is exported,
6580+
or if it contains any
6581+
\grammarterm{export-declaration}{s}\iref{module.interface}.
6582+
A namespace is never attached to a module,
6583+
and never has module linkage
6584+
even if it is not exported.
6585+
\end{note}
6586+
\begin{example}
6587+
\begin{codeblock}
6588+
export module M;
6589+
namespace N1 {} // \tcode{N1} is not exported
6590+
export namespace N2 {} // \tcode{N2} is exported
6591+
namespace N3 { export int n; } // \tcode{N3} is exported
6592+
\end{codeblock}
6593+
\end{example}
6594+
65456595
\pnum
65466596
The outermost declarative region of a translation unit is a namespace;
65476597
see~\ref{basic.scope.namespace}.

source/lex.tex

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@
4242
\begin{note} Previously translated translation units and instantiation
4343
units can be preserved individually or in libraries. The separate
4444
translation units of a program communicate\iref{basic.link} by (for
45-
example) calls to functions whose identifiers have external linkage,
46-
manipulation of objects whose identifiers have external linkage, or
45+
example)
46+
calls to functions whose identifiers have external or module linkage,
47+
manipulation of objects whose identifiers have external or module linkage, or
4748
manipulation of data files. Translation units can be separately
4849
translated and then later linked to produce an executable
4950
program\iref{basic.link}. \end{note}%
@@ -139,7 +140,18 @@
139140
semantically analyzed and translated as a translation unit. \begin{note}
140141
The process of analyzing and translating the tokens may occasionally
141142
result in one token being replaced by a sequence of other
142-
tokens\iref{temp.names}.\end{note} \begin{note} Source files, translation
143+
tokens\iref{temp.names}.\end{note}
144+
It is
145+
\impldef{whether the sources for
146+
module units and header units
147+
on which the current translation unit has an interface
148+
dependency are required to be available during translation}
149+
whether the sources for
150+
module units and header units
151+
on which the current translation unit has an interface
152+
dependency (\ref{module.unit}, \ref{module.import})
153+
are required to be available.
154+
\begin{note} Source files, translation
143155
units and translated translation units need not necessarily be stored as
144156
files, nor need there be any one-to-one correspondence between these
145157
entities and any external representation. The description is conceptual
@@ -314,7 +326,20 @@
314326
characters that could constitute a preprocessing token, even if that
315327
would cause further lexical analysis to fail,
316328
except that a \grammarterm{header-name}\iref{lex.header} is only formed
317-
within a \tcode{\#include} directive\iref{cpp.include}.
329+
\begin{itemize}
330+
\item
331+
within a \tcode{\#include} directive\iref{cpp.include},
332+
333+
\item
334+
within a \grammarterm{has-include-expression}, or
335+
336+
\item
337+
outside of any preprocessing directive,
338+
if applying phase 4 of translation to the sequence
339+
of preprocessing tokens produced thus far
340+
is valid and
341+
results in an \grammarterm{import-seq}\iref{cpp.module}.
342+
\end{itemize}
318343
\end{itemize}
319344

320345
\begin{example}
@@ -628,14 +653,18 @@
628653
\grammarterm{identifier} has a special meaning is resolved to interpret the
629654
token as a regular \grammarterm{identifier}.
630655

631-
\begin{floattable}{Identifiers with special meaning}{tab:identifiers.special}
632-
{llll}
656+
\begin{multicolfloattable}{Identifiers with special meaning}{tab:identifiers.special}
657+
{lll}
633658
\topline
634-
\tcode{audit} &
635-
\tcode{axiom} &
636-
\tcode{final} &
659+
\tcode{audit} \\
660+
\tcode{axiom} \\
661+
\columnbreak
662+
\tcode{import} \\
663+
\tcode{final} \\
664+
\columnbreak
665+
\tcode{module} \\
637666
\tcode{override} \\
638-
\end{floattable}
667+
\end{multicolfloattable}
639668

640669
\pnum
641670
\indextext{\idxcode{_}|see{character, underscore}}%
@@ -755,8 +784,8 @@
755784
\tcode{while} \\
756785
\end{multicolfloattable}
757786

758-
\begin{note} The \tcode{export} and \tcode{register} keywords are unused but
759-
are reserved for future use.\end{note}
787+
\begin{note} The \tcode{register} keyword is unused but
788+
is reserved for future use.\end{note}
760789

761790
\pnum
762791
Furthermore, the alternative representations shown in

source/macros.tex

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,26 @@
407407

408408
\lstnewenvironment{codeblock}{\CodeBlockSetup}{}
409409

410+
% Left-align listings titles
411+
\makeatletter
412+
\def\lst@maketitle{\@makeleftcaption\lst@title@dropdelim}
413+
\long\def\@makeleftcaption#1#2{%
414+
\vskip\abovecaptionskip
415+
\sbox\@tempboxa{#1: #2}%
416+
\ifdim \wd\@tempboxa >\hsize
417+
#1: #2\par
418+
\else
419+
\global \@minipagefalse
420+
\hb@xt@\hsize{%\hfil -- REMOVED
421+
\box\@tempboxa\hfil}%
422+
\fi
423+
\vskip\belowcaptionskip}%
424+
\makeatother
425+
426+
\lstnewenvironment{codeblocktu}[1]{%
427+
\lstset{title={%\parabullnum{Bullets1}{0pt}
428+
#1:}}\CodeBlockSetup}{}
429+
410430
% An environment for command / program output that is not C++ code.
411431
\lstnewenvironment{outputblock}{\lstset{language=}}{}
412432

0 commit comments

Comments
 (0)