Skip to content

Commit 613b746

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 a7d8869 commit 613b746

File tree

11 files changed

+1839
-122
lines changed

11 files changed

+1839
-122
lines changed

source/basic.tex

Lines changed: 307 additions & 69 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
@@ -1031,27 +1032,46 @@
10311032
been declared inline.
10321033

10331034
\pnum
1034-
An inline function or variable shall be defined in every translation unit in which
1035-
it is odr-used and shall have exactly the same definition in every
1036-
case\iref{basic.def.odr}.
1035+
If an inline function or variable
1036+
is odr-used in a translation unit,
1037+
a definition of it shall be reachable from the end of that translation unit,
1038+
and it shall have exactly the same definition
1039+
in every such translation unit\iref{basic.def.odr}.
10371040
\begin{note}
10381041
A call to the inline function or a use of the inline variable may be encountered before its definition
10391042
appears in the translation unit.
10401043
\end{note}
1041-
If the definition of a function or variable appears in a translation unit before its
1044+
If a definition of a function or variable is reachable
1045+
at the point of its
10421046
first declaration as inline, the program is ill-formed. If a function or variable
1043-
with external linkage is declared inline in one translation unit, it
1044-
shall be declared inline in all translation units in which it appears;
1045-
no diagnostic is required. An inline function or variable with external
1046-
linkage shall have the same address in all translation units.
1047+
with external or module linkage
1048+
is declared inline in one translation unit,
1049+
there shall be a reachable inline declaration
1050+
in all translation units in which it is declared;
1051+
no diagnostic is required.
1052+
An inline function or variable
1053+
with external or module linkage
1054+
shall have the same address in all translation units.
10471055
\begin{note}
10481056
A \tcode{static} local variable in an inline
1049-
function with external linkage always refers to the same object.
1057+
function with external or module linkage
1058+
always refers to the same object.
10501059
A type defined within the body of an inline
1051-
function with external linkage is the
1060+
function with external or module linkage is the
10521061
same type in every translation unit.
10531062
\end{note}
10541063

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

@@ -1709,6 +1729,17 @@
17091729
\end{codeblock}
17101730
\end{example}
17111731

1732+
\pnum
1733+
An exported function
1734+
with a declared return type that uses a placeholder type
1735+
shall be defined in the translation unit
1736+
containing its exported declaration,
1737+
outside the \grammarterm{private-module-fragment} (if any).
1738+
\begin{note}
1739+
There is no restriction on the linkage of
1740+
the deduced return type.
1741+
\end{note}
1742+
17121743
\pnum
17131744
If the name of an entity with an undeduced placeholder type appears in an
17141745
expression, the program is ill-formed. Once a
@@ -6642,6 +6673,25 @@
66426673
the definition of a namespace can be split over several parts of one or
66436674
more translation units.
66446675

6676+
\pnum
6677+
\begin{note}
6678+
A namespace name with external linkage is exported
6679+
if any of its \term{namespace-definition}{s} is exported,
6680+
or if it contains any
6681+
\grammarterm{export-declaration}{s}\iref{module.interface}.
6682+
A namespace is never attached to a module,
6683+
and never has module linkage
6684+
even if it is not exported.
6685+
\end{note}
6686+
\begin{example}
6687+
\begin{codeblock}
6688+
export module M;
6689+
namespace N1 {} // \tcode{N1} is not exported
6690+
export namespace N2 {} // \tcode{N2} is exported
6691+
namespace N3 { export int n; } // \tcode{N3} is exported
6692+
\end{codeblock}
6693+
\end{example}
6694+
66456695
\pnum
66466696
The outermost declarative region of a translation unit is a namespace;
66476697
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
@@ -324,7 +336,20 @@
324336
characters that could constitute a preprocessing token, even if that
325337
would cause further lexical analysis to fail,
326338
except that a \grammarterm{header-name}\iref{lex.header} is only formed
327-
within a \tcode{\#include} directive\iref{cpp.include}.
339+
\begin{itemize}
340+
\item
341+
within a \tcode{\#include} directive\iref{cpp.include},
342+
343+
\item
344+
within a \grammarterm{has-include-expression}, or
345+
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}.
352+
\end{itemize}
328353
\end{itemize}
329354

330355
\begin{example}
@@ -638,14 +663,18 @@
638663
\grammarterm{identifier} has a special meaning is resolved to interpret the
639664
token as a regular \grammarterm{identifier}.
640665

641-
\begin{floattable}{Identifiers with special meaning}{tab:identifiers.special}
642-
{llll}
666+
\begin{multicolfloattable}{Identifiers with special meaning}{tab:identifiers.special}
667+
{lll}
643668
\topline
644-
\tcode{audit} &
645-
\tcode{axiom} &
646-
\tcode{final} &
669+
\tcode{audit} \\
670+
\tcode{axiom} \\
671+
\columnbreak
672+
\tcode{import} \\
673+
\tcode{final} \\
674+
\columnbreak
675+
\tcode{module} \\
647676
\tcode{override} \\
648-
\end{floattable}
677+
\end{multicolfloattable}
649678

650679
\pnum
651680
\indextext{\idxcode{_}|see{character, underscore}}%
@@ -765,8 +794,8 @@
765794
\tcode{while} \\
766795
\end{multicolfloattable}
767796

768-
\begin{note} The \tcode{export} and \tcode{register} keywords are unused but
769-
are reserved for future use.\end{note}
797+
\begin{note} The \tcode{register} keyword is unused but
798+
is reserved for future use.\end{note}
770799

771800
\pnum
772801
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)