Skip to content

Commit fb9c2f0

Browse files
authored
Merge 2022-11 CWG Motion 11
P2615R1 Meaningful exports
2 parents c40de80 + f3ffeb4 commit fb9c2f0

File tree

4 files changed

+25
-24
lines changed

4 files changed

+25
-24
lines changed

source/basic.tex

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
Every name is introduced by a \defn{declaration}, which is a
4949
\begin{itemize}
5050
\item
51-
\grammarterm{declaration},
51+
\grammarterm{name-declaration},
5252
\grammarterm{block-declaration}, or
5353
\grammarterm{member-declaration}\iref{dcl.pre,class.mem},
5454
\item
@@ -1753,10 +1753,6 @@
17531753
if it precedes $P$ and inhabits either $S$ or
17541754
the scope of a namespace nominated by a \grammarterm{using-directive}
17551755
that is active in $S$ at $P$.
1756-
\begin{note}
1757-
A \grammarterm{using-directive} is exported if and only if
1758-
it appears in a header unit.
1759-
\end{note}
17601756

17611757
\pnum
17621758
An \term{unqualified search} in a scope $S$ from a program point $P$

source/declarations.tex

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,31 @@
1919

2020
\begin{bnf}
2121
\nontermdef{declaration}\br
22+
name-declaration\br
23+
special-declaration
24+
\end{bnf}
25+
26+
\begin{bnf}
27+
\nontermdef{name-declaration}\br
2228
block-declaration\br
2329
nodeclspec-function-declaration\br
2430
function-definition\br
2531
template-declaration\br
2632
deduction-guide\br
27-
explicit-instantiation\br
28-
explicit-specialization\br
29-
export-declaration\br
3033
linkage-specification\br
3134
namespace-definition\br
3235
empty-declaration\br
3336
attribute-declaration\br
3437
module-import-declaration
3538
\end{bnf}
3639

40+
\begin{bnf}
41+
\nontermdef{special-declaration}\br
42+
explicit-instantiation\br
43+
explicit-specialization\br
44+
export-declaration
45+
\end{bnf}
46+
3747
\begin{bnf}
3848
\nontermdef{block-declaration}\br
3949
simple-declaration\br
@@ -8151,7 +8161,7 @@
81518161
\begin{bnf}
81528162
\nontermdef{linkage-specification}\br
81538163
\keyword{extern} string-literal \terminal{\{} \opt{declaration-seq} \terminal{\}}\br
8154-
\keyword{extern} string-literal declaration
8164+
\keyword{extern} string-literal name-declaration
81558165
\end{bnf}
81568166

81578167
The \grammarterm{string-literal} indicates the required language linkage.
@@ -8185,9 +8195,6 @@
81858195
\end{example}
81868196

81878197
\pnum
8188-
A \grammarterm{module-import-declaration}
8189-
shall not be directly contained in
8190-
a \grammarterm{linkage-specification}.
81918198
A \grammarterm{module-import-declaration} appearing in
81928199
a linkage specification with other than \Cpp{} language linkage
81938200
is conditionally-supported with

source/modules.tex

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196

197197
\begin{bnf}
198198
\nontermdef{export-declaration}\br
199-
\keyword{export} declaration\br
199+
\keyword{export} name-declaration\br
200200
\keyword{export} \terminal{\{} \opt{declaration-seq} \terminal{\}}\br
201201
export-keyword module-import-declaration
202202
\end{bnf}
@@ -209,10 +209,12 @@
209209
or a \grammarterm{private-module-fragment}.
210210
An \grammarterm{export-declaration}
211211
has the declarative effects of its
212-
\grammarterm{declaration},
212+
\grammarterm{name-declaration},
213213
\grammarterm{declaration-seq} (if any), or
214214
\grammarterm{module-import-declaration}.
215-
The \grammarterm{declaration} or \grammarterm{declaration-seq} of
215+
The \grammarterm{name-declaration} of an \grammarterm{export-declaration}
216+
shall not declare a partial specialization\iref{temp.decls.general}.
217+
The \grammarterm{declaration-seq} of
216218
an \grammarterm{export-declaration}
217219
shall not contain an \grammarterm{export-declaration} or
218220
\grammarterm{module-import-declaration}.
@@ -232,10 +234,7 @@
232234
\end{itemize}
233235

234236
\pnum
235-
An exported declaration
236-
that is not a \grammarterm{module-import-declaration}
237-
shall declare at least one name.
238-
If the declaration is not within a header unit,
237+
If an exported declaration is not within a header unit,
239238
it shall not declare a name with internal linkage.
240239

241240
\pnum
@@ -249,17 +248,14 @@
249248
#include "a.h" // error: declaration of \tcode{x} is not in the
250249
// purview of a module interface unit
251250
export module M;
252-
export namespace {} // error: does not introduce any names
253-
export namespace {
254-
int a1; // error: export of name with internal linkage
255-
}
251+
export namespace {} // error: namespace has internal linkage
256252
namespace {
257253
export int a2; // error: export of name with internal linkage
258254
}
259255
export static int b; // error: b explicitly declared static
260256
export int f(); // OK
261257
export namespace N { } // OK
262-
export using namespace N; // error: does not declare a name
258+
export using namespace N; // OK
263259
\end{codeblocktu}
264260
\end{example}
265261

source/templates.tex

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6379,6 +6379,8 @@
63796379
\end{example}
63806380

63816381
\pnum
6382+
The \grammarterm{declaration} in an \grammarterm{explicit-specialization}
6383+
shall not be an \grammarterm{export-declaration}.
63826384
An explicit specialization shall not use
63836385
a \grammarterm{storage-class-specifier}\iref{dcl.stc}
63846386
other than \keyword{thread_local}.

0 commit comments

Comments
 (0)