├── README.md └── src ├── .gitignore ├── Makefile ├── back.tex ├── basic.tex ├── classes.tex ├── config.tex ├── cover-reg.tex ├── cover-wd.tex ├── cxx.tex ├── declarations.tex ├── definitions.tex ├── front.tex ├── general.tex ├── layout.tex ├── lexical.tex ├── macros.tex ├── overloading.tex ├── references.tex ├── scope.tex ├── styles.tex ├── tables.tex ├── templates.tex └── ts.tex /README.md: -------------------------------------------------------------------------------- 1 | is the repository for the 2 | C++ Technical Specification "Extensions for Modules". 3 | 4 | The draft Technical Specification is found in the `src` directory 5 | and is written in LaTeX. There is a Makefile that can be used to compile 6 | the sources, or you can use the `latexmk` program e.g. `latexmk -pdf ts` will 7 | generate a PDF. 8 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.idx 3 | *.ilg 4 | *.ind 5 | ts.* 6 | !ts.tex 7 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | ### -*- mode: makefile-gmake -*- 2 | 3 | # Note: If building on Mac OS X, and if you use MacPorts, the following ports 4 | # should be installed: 5 | # 6 | # texlive-latex 7 | # texlive-plain-extra 8 | # texlive-latex-recommended 9 | # texlive-latex-extra 10 | # texlive-fonts-recommended 11 | # texlive-fonts-extra 12 | # texlive-generic-recommended 13 | 14 | FIGURES = $(patsubst %.dot,%.pdf,$(wildcard *.dot)) 15 | 16 | TSPDF = pdflatex ts | grep -v "^Overfull" 17 | 18 | default: rebuild 19 | 20 | clean: 21 | rm -f *.aux *.idx *.ilg *.ind *.log *.lot *.lof *.tmp *.out *.toc ts.pdf 22 | 23 | refresh: 24 | $(TSPDF) 25 | 26 | rebuild: 27 | $(TSPDF) 28 | $(TSPDF) 29 | $(TSPDF) 30 | 31 | full: $(FIGURES) grammar xrefs reindex 32 | 33 | %.pdf: %.dot 34 | dot -o $@ -Tpdf $< 35 | 36 | grammar: 37 | sh ../tools/makegram 38 | 39 | xrefs: 40 | sh ../tools/makexref 41 | 42 | # reindex: 43 | # $(TSPDF) 44 | # $(TSPDF) 45 | # $(TSPDF) 46 | # makeindex generalindex 47 | # makeindex libraryindex 48 | # makeindex grammarindex 49 | # makeindex impldefindex 50 | # $(TSPDF) 51 | # $(TSPDF) 52 | 53 | ### Makefile ends here 54 | -------------------------------------------------------------------------------- /src/back.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | 3 | % Prevent previous section name appearing in footer in indices: 4 | \renewcommand{\leftmark}{} 5 | 6 | \printindex[generalindex] 7 | 8 | \clearpage 9 | \renewcommand{\preindexhook}{} 10 | \renewcommand{\indexname}{Index of library names} 11 | \printindex[libraryindex] 12 | 13 | \clearpage 14 | \renewcommand{\preindexhook}{The entries in this section are rough descriptions; exact 15 | specifications are at the indicated page in the general text.\\} 16 | % FIXME: There must be a better way to get a one-column index, 17 | % but makeindex[impldefindex, columns=1] doesn't work. 18 | \renewcommand{\twocolumn}[1][]{#1} 19 | \renewcommand{\indexname}{Index of implementation-defined behavior} 20 | \printindex[impldefindex] 21 | -------------------------------------------------------------------------------- /src/basic.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = std.tex 2 | \rSec0[basic]{Basic concepts} 3 | 4 | %gram: \rSec1[gram.basic]{Basic concepts} 5 | %gram: 6 | 7 | \noindent 8 | Modify paragraph 6/3 as follows: 9 | 10 | %\pnum 11 | \resetalinea[2] 12 | \begin{std.txt} 13 | \alinea 14 | An \emph{entity} is a value, object, reference, function, 15 | enumerator, type, class member, bit-field, template, template 16 | specialization, namespace, \added{module}, or parameter pack. 17 | \end{std.txt} 18 | 19 | \noindent 20 | Modify paragraph 6/4 as follows: 21 | 22 | \resetalinea[3] 23 | \begin{std.txt} 24 | \alinea 25 | A \emph{name} is a use of an \grammarterm{identifier} (5.10), 26 | \grammarterm{operator-function-id} (16.5), \grammarterm{literal-operator-id} 27 | (16.5.8), 28 | \grammarterm{conversion-function-id} (15.3.2), \removed{or } 29 | \grammarterm{template-id} (17.2), \added{or \grammarterm{module-name} (10.7)} that 30 | denotes an entity or \grammarterm{label} (9.6.4, 9.1). 31 | \end{std.txt} 32 | 33 | \noindent 34 | Add a sixth bullet to paragraph 6/8 as follows: 35 | 36 | \resetalinea[7] 37 | \begin{std.txt}\color{addclr} 38 | \begin{itemize} 39 | \item[--] \added{they are \grammarterm{module-name}{s} composed of the same 40 | dotted sequence of \grammarterm{identifier}{s}.} 41 | \end{itemize} 42 | \end{std.txt} 43 | 44 | \rSec1[basic.def]{Declarations and definitions} 45 | 46 | Modify paragraph 6.1/1 as follows: 47 | \begin{std.txt} 48 | \resetalinea[0] 49 | \alinea 50 | A declaration (Clause \ref{dcl.dcl}) may introduce one or more names into a 51 | translation unit or redeclare names introduced by previous declarations. 52 | If so, the declaration specifies the interpretation and 53 | \removed{attributes}\added{semantic properties} of these names. [...] 54 | \end{std.txt} 55 | 56 | \noindent 57 | Append the following two bullets to paragraph 6.1/2: 58 | \begin{std.txt} 59 | \resetalinea[1] 60 | \alinea 61 | A declaration is a \term{definition} unless 62 | \begin{itemize} 63 | \item ... 64 | \item it is an explicit specialization (17.7.3) whose \grammarterm{declaration} 65 | is not definition\removed{.}\added{,} 66 | \color{addclr} 67 | \item \added{it is a \grammarterm{module-import-declaration},} 68 | \item \added{it is a \grammarterm{proclaimed-ownership-declaration}.} 69 | \end{itemize} 70 | \color{addclr} 71 | % \begin{example} 72 | \enterexample 73 | \begin{codeblock} 74 | import std.io; // make names from std.io available 75 | export module M; // toplevel declaration for M 76 | export struct Point { // define and export Point 77 | int x; 78 | int y; 79 | }; 80 | \end{codeblock} 81 | \exitexample 82 | \end{std.txt} 83 | 84 | 85 | \rSec1[basic.def.odr]{One-definition rule} 86 | 87 | Replace paragraph 6.2/1 with: 88 | \begin{std.txt}\color{addclr} 89 | \resetalinea[0] 90 | \alinea 91 | \added{A variable, function, class type, enumeration type, or template shall not 92 | be defined where a prior definition is reachable (\ref{basic.lookup}).} 93 | \end{std.txt} 94 | 95 | Modify opening of paragraph 6.2/6 as follows 96 | \begin{std.txt} 97 | \resetalinea[5] 98 | \alinea 99 | There can be more than one definition of a class type (Clause 12), 100 | enumeration type (10.2), inline function with external \added{or module} 101 | linkage (10.1.6), 102 | inline variable with external \added{or module} linkage (10.1.6), 103 | class template (Clause 17), 104 | non-static function template (17.5.6), static data member of a class 105 | template (17.5.1.3), member function of a class template (17.5.1.1), or 106 | template specialization for which some template parameters are not 107 | specified (17.7, 17.5.5) in a program provided that \removed{each definition appears 108 | in a different translation unit} 109 | \added{no prior definition is reachable (\ref{basic.lookup}) at the point where a definition appears}, 110 | and provided the definitions satisfy the 111 | following requirements. 112 | \added{For an entity with an exported declaration, there shall be only one 113 | definition of that entity; a diagnostic is required only if the abstract 114 | semantics graph of the module contains a definition of the entity.} 115 | \added{\enternote 116 | If the definition is not in the interface unit, then at most one module unit can 117 | have and make use of the definition. 118 | \exitnote} 119 | Given such an entity named \tcode{D} defined in more than one 120 | translation unit, then 121 | \end{std.txt} 122 | 123 | 124 | 125 | \rSec1[basic.scope]{Scope}% 126 | 127 | \setcounter{subsection}{1} 128 | \rSec2[basic.scope.pdecl]{Point of declaration} 129 | 130 | \noindent 131 | Add a new paragraph 6.3.2/13 as follows: 132 | \resetalinea[12] 133 | \begin{std.txt}\color{addclr} 134 | \alinea 135 | \added{The point of declaration of a module is immediately after the 136 | \term{module-name} in a \grammarterm{module-declaration}.} 137 | \end{std.txt} 138 | 139 | \setcounter{subsection}{5} 140 | \rSec2[basic.scope.namespace]{Namespace scope} 141 | 142 | From end-user perspective, there are really no new lookup rules to 143 | learn. The ``old'' rules are the ``new'' rules, with appropriate 144 | adjustment in the definition of ``associated entities.'' 145 | 146 | \noindent 147 | Modify paragraph 6.3.6/1 as follows: 148 | \begin{std.txt} 149 | \resetalinea[0] 150 | \alinea 151 | The declarative region of a \grammarterm{namespace-definition} is its 152 | \grammarterm{namespace-body}. 153 | Entities declared in a \grammarterm{namespace-body} 154 | are said to be members of the namespace, and names introduced by 155 | these declarations 156 | into the declarative region of the namespace are said to be 157 | \term{member names} of the namespace. A namespace member name 158 | has namespace 159 | scope. Its potential scope includes its namespace from the name's 160 | point of declaration (6.3.2) onwards; 161 | and for each \grammarterm{using-directive} 162 | (10.3.4) that nominates the member's namespace, the member's 163 | potential scope includes that portion of the potential scope of the 164 | \grammarterm{using-directive} that follows the member's point of 165 | declaration. \added{If a name $X$ (not having internal linkage) is declared 166 | in a namespace $N$ in the purview of the module 167 | interface unit of a module $M$, the potential scope of $X$ 168 | includes the portion of the namespace $N$ in the purview of 169 | every module implementation unit of $M$ 170 | and, if the name $X$ is exported, in every translation unit that imports $M$ 171 | after a \grammarterm{module-import-declaration} nominating $M$. 172 | } 173 | \color{addclr} 174 | % ; and for each \term{module-import-declaration} that nominates M, 175 | % the potential scope of X includes the 176 | % portion of the potential scope of the \term{using-directive} that 177 | % follows that \term{module-import-declaration}. 178 | \enterexample 179 | \begin{codeblock} 180 | // Translation unit \#1 181 | export module M; 182 | export int sq(int i) { return i*i; } 183 | 184 | // Translation unit \#2 185 | import M; 186 | int main() { return sq(9); } // OK: 'sq' from module M 187 | \end{codeblock} 188 | \exitexample 189 | \end{std.txt} 190 | 191 | 192 | \setcounter{section}{3} 193 | \rSec1[basic.lookup]{Name lookup} 194 | 195 | Modify paragraph 6.4/1 as follows: 196 | \begin{std.txt} 197 | \resetalinea[0] 198 | \alinea 199 | The name lookup rules apply uniformly to all names 200 | (including \grammarterm{typedef-name}{s} (10.1.3), 201 | \grammarterm{namespace-name}{s} (10.3), and 202 | \grammarterm{class-name}{s} (12.1)) 203 | wherever the grammar allows such names in the context discussed by a 204 | particular rule. 205 | Name lookup associates the use of a name with a set of declarations (6.1) 206 | \added{or citations (\ref{dcl.module.import})} of that name. 207 | \added{For all intent and purposes of further semantic processing 208 | requiring declarations, 209 | a citation is replaced with the declarations contained in its declset.} 210 | [...] Only after name lookup, function overload resolution (if applicable) 211 | and access checking have succeeded are the 212 | \removed{attributes}\added{semantic properties} introduced by the name's 213 | declaration used further in the expression processing (Clause 8). 214 | 215 | \end{std.txt} 216 | 217 | Add new paragraph 6.4/5 as follows: 218 | \begin{std.txt}\color{addclr} 219 | \resetalinea[4] 220 | \alinea 221 | \added{A declaration is \term{reachable} from a program point if it can be found 222 | by unqualified name lookup in its scope.} 223 | \end{std.txt} 224 | 225 | \setcounter{subsection}{1} 226 | \rSec2[basic.lookup.argdep]{Argument-dependent name lookup} 227 | 228 | \noindent 229 | Modify paragraph 6.4.2/2 as follows: 230 | \begin{std.txt} 231 | \resetalinea[1] 232 | \alinea 233 | For each argument type \tcode{T} in the function call, there is a 234 | set of zero or more \term{associated namespaces} (10.3) and a set of 235 | zero or more \term{associated \removed{classes} \added{entities}} 236 | \added{(other than namespaces)} to be considered. The sets of 237 | namespaces and \removed{classes} \added{entities} are determined 238 | entirely by the types of the function arguments (and the namespace 239 | of any template template argument). Typedef names and 240 | \grammarterm{using-declaration}{s} used to specify the types do not 241 | contribute to this set. The sets of namespaces 242 | and \removed{classes} \added{entities} are determined in the 243 | following way: 244 | \begin{itemize} 245 | \item[---] If \tcode{T} is a fundamental type, its associated sets 246 | of namespaces and \removed{classes} \added{entities} are both empty. 247 | 248 | \item[---] If \tcode{T} is a class type (including unions), its 249 | associated \removed{classes} \added{entities} are the class itself; 250 | the class of which it is a member, if any; and its direct and 251 | indirect base classes. Its associated namespaces are the innermost 252 | enclosing namespaces of its associated \removed{classes} \added{entities}. 253 | Furthermore, if \tcode{T} is a class template specialization, its 254 | associated namespaces and \removed{classes} \added{entities} also 255 | include: the namespace and \removed{classes} \added{entities} 256 | associated with the types of the template arguments provided for 257 | template type parameters (excluding template template arguments); 258 | \added{the templates used as template template arguments;} the 259 | namespaces of which any template template arguments are members; 260 | and the classes of which any member template used as template 261 | template arguments are members. \enternote Non-type template 262 | arguments do not contribute to the set of associated namespaces. \exitnote 263 | 264 | \item[---] If \tcode{T} is an enumeration type, its associated 265 | namespace is the innermost enclosing namespace of its 266 | declaration\added{, and its associated entities are \tcode{T}, and, 267 | if}\removed{. If} it is a class member, \removed{its associated 268 | class is} the member's class\removed{; else it has no associated class}. 269 | 270 | \item[---] If \tcode{T} is a pointer to \tcode{U} or an array 271 | of \tcode{U}, its associated namespaces 272 | and \removed{classes} \added{entities} are those associated 273 | with \tcode{U}. 274 | 275 | \item[---] If \tcode{T} is a function type, its associated 276 | namespaces and \removed{classes} \added{entities} are those 277 | associated with the function parameter types and those associated 278 | with the return type. 279 | 280 | \item[---] If \tcode{T} is a pointer to a data member of 281 | class \tcode{X}, its associated namespaces 282 | and \removed{classes} \added{entities} are those associated with the 283 | member type together with those associated with \tcode{X}. 284 | \end{itemize} 285 | 286 | If an associated namespace is an inline namespace (10.3.1), its 287 | enclosing namespace is also included in the set. If an associated 288 | namespace directly contains inline namespaces, those inline 289 | namespaces are also included in the set. In addition, if the 290 | argument is the name or address of a set of overloaded functions 291 | and/or function templates, its 292 | associated \removed{classes} \added{entities} and namespaces are the 293 | union of those associated with each of the members of the set, i.e., 294 | the \removed{classes} \added{entities} and namespaces associated 295 | with its parameter types and return type. Additionally, if the 296 | aforementioned set of overloaded functions is named with 297 | a \grammarterm{template-id}, its 298 | associated \removed{classes} \added{entities} and namespaces also 299 | include those of its type \grammarterm{template-argument}{s} and its 300 | template \grammarterm{template-argument}{s}. 301 | \end{std.txt} 302 | 303 | \noindent 304 | Modify paragraph 6.4.2/4 as follows: 305 | \begin{std.txt} 306 | \resetalinea[3] 307 | \alinea 308 | When considering an associated namespace, the lookup is the same as 309 | the lookup performed when the associated namespace is used as a 310 | qualifier (6.4.3.2) except that: 311 | \begin{itemize} 312 | \item[---] Any \grammarterm{using-directive}{s} in the associated 313 | namespace are ignored. 314 | 315 | \item Any namespace-scope friend declaration functions or friend 316 | function templates declared in \removed{associated} 317 | classes \added{in the set of associated entities} are visible within 318 | their respective namespaces even if they are not visible during an 319 | ordinary lookup (14.3). 320 | 321 | \item All names except those of (possibly overloaded) functions 322 | and function templates are ignored. 323 | 324 | \color{addclr} 325 | \item[---] \added{In resolving dependent names (17.6.4), 326 | any function or function template that is owned by a 327 | named module \tcode{M} (10.7), that is 328 | declared in the module interface unit of \tcode{M}, and that has 329 | the same innermost enclosing non-inline namespace as some entity 330 | owned by \tcode{M} in the set of associated entities, is visible 331 | within its namespace even if it is not exported.} 332 | \end{itemize} 333 | \end{std.txt} 334 | 335 | \setcounter{section}{4} 336 | \rSec1[basic.link]{Program and linkage}% 337 | 338 | \resetalinea[0] 339 | 340 | Change the definition of \term{translation-unit} in paragraph 6.5/1 341 | to: 342 | 343 | 344 | \begin{bnf}\color{addclr} 345 | \added{\nonterminal{translation-unit}\br 346 | toplevel-declaration-seq\opt} 347 | \end{bnf} 348 | 349 | \begin{bnf}\color{addclr} 350 | \added{\nonterminal{toplevel-declaration-seq}\br 351 | toplevel-declaration\br 352 | toplevel-declaration-seq toplevel-declaration} 353 | \end{bnf} 354 | 355 | \begin{bnf}\color{addclr} 356 | \added{\nonterminal{toplevel-declaration}\br 357 | module-declaration\br 358 | declaration} 359 | \end{bnf} 360 | 361 | 362 | 363 | \noindent 364 | Insert a new bullet between first and second bullet of paragraph 6.5/2: 365 | 366 | \begin{std.txt}\color{addclr} 367 | \begin{itemize} 368 | \item[---] \added{When a name has \term{module linkage}, the entity it denotes 369 | can be referred to by names 370 | from other scopes of the same module unit (\ref{dcl.module.unit}) 371 | or from scopes of 372 | other module units of that same module.} 373 | \end{itemize} 374 | \end{std.txt} 375 | 376 | \noindent 377 | Modify bullet (3.2) of paragraph 6.5/3 as follows: 378 | \begin{std.txt} 379 | \begin{itemize} 380 | \item[---] a non-inline \added{non-exported} variable of non-volatile const-qualified type 381 | that is neither explicitly declared \tcode{extern} nor 382 | previously declared to have external \added{or module} linkage; or 383 | \end{itemize} 384 | \end{std.txt} 385 | 386 | \noindent 387 | Modify paragraph 6.5/4 as follows: 388 | %\begin{std.txt} 389 | % \resetalinea[3] 390 | % \alinea 391 | % An unnamed namespace or a namespace declared directly or 392 | % indirectly within an unnamed namespace has internal linkage. All other 393 | % namespaces have external linkage. 394 | % \added{A name declared at namespace scope in the purview of a named module 395 | % that does not have internal linkage by the previous rules and that 396 | % is not exported has module 397 | % linkage. The name of any class member where the enclosing class has 398 | % a name with module linkage also has module linkage.} 399 | % A name having namespace scope that has 400 | % not been given internal \added{or module} linkage above has the same linkage as the enclosing 401 | % namespace if it is the name of 402 | %\end{std.txt} 403 | %% New wording suggested by Hubert Tong, on December 17, 2017. 404 | \begin{std.txt} 405 | \resetalinea[3] 406 | \alinea 407 | An unnamed namespace or a namespace declared directly or 408 | indirectly within an unnamed namespace has internal linkage. All other 409 | namespaces have external linkage. 410 | A name having namespace scope that has 411 | not been given internal linkage above \removed{has the same linkage as the enclosing 412 | namespace if it}\added{and that} is the name of 413 | \begin{itemize} 414 | \item a variable; or 415 | \item a function; or 416 | \item a named class (Clause 12), or an unnamed class defined in a 417 | typedef declaration in which the class has the typedef name for 418 | linkage purposes (10.1.3); or 419 | \item a named enumeration (10.2), or an unnamed enumeration defined in 420 | a typedef declaration in which the enumeration has the typedef name for 421 | linkage purposes (10.1.3); or 422 | \item a template\removed{.} 423 | \end{itemize} 424 | \color{addclr} 425 | \added{has the same linkage as the enclosing namespace if} 426 | \begin{itemize} 427 | \item \added{said namespace has internal linkage, or} 428 | \item \added{the name is exported (\ref{dcl.module.interface}), 429 | or is declared in a \grammarterm{proclaimed-ownership-declaration}, 430 | or is not being declared in the purview of 431 | a named module (\ref{dcl.module.unit});} 432 | \end{itemize} 433 | \added{otherwise, the name has module linkage.} 434 | \end{std.txt} 435 | 436 | 437 | \noindent 438 | Modify 6.5/6 as follows: 439 | \begin{std.txt} 440 | \resetalinea[5] 441 | \alinea 442 | The name of a function declared in block scope and the name of a 443 | variable declared by a block scope extern declaration have linkage. If 444 | there is a visible declaration of an entity with linkage having the 445 | same name and type, ignoring entities declared outside the innermost 446 | enclosing namespace scope, the block scope declaration declares that 447 | same entity and receives the linkage of the previous declaration. 448 | \added{If that entity was exported by an imported module or if the containing block scope is in the purview of a named module, the program is 449 | ill-formed.} If 450 | there is more than one such matching entity, the program is 451 | ill-formed. Otherwise, if no matching entity is found, the block scope 452 | entity receives external linkage. 453 | \end{std.txt} 454 | 455 | \noindent 456 | Modify paragrapgh 6.5/9 as follows: 457 | \begin{std.txt} 458 | \resetalinea[8] 459 | \alinea 460 | Two names that are the same (Clause 9) and that are declared in different scopes 461 | shall denote the same variable, function, type, template or namespace if 462 | \begin{itemize} 463 | \item[---] both names have external \added{or module} linkage 464 | \added{and are declared in declarations attached to the 465 | same module}{\color{addclr}\footnote{This provision supports implementations where 466 | exported entities in different modules have different implementation 467 | symbols. Conversely, for other implementations, exported entities 468 | have the same implementation symbols regardless of in which 469 | module they are declared. Such implementations are supported 470 | for the time being by disallowing all situations where the same names 471 | with external linkage might appear from different modules.}}\added{,} 472 | or else both names have internal linkage and are declared in 473 | the same translation unit; and 474 | 475 | \item both names refer to members of the same namespace or to members, 476 | not by inheritance, of the same class; and 477 | 478 | \item when both names denote functions, the parameter-typelists of the 479 | functions (11.3.5) are identical; and 480 | 481 | \item when both names denote function templates, the signatures (17.5.6.1) 482 | ar the same. 483 | \end{itemize} 484 | \added{If two declarations 485 | declaring entities (other than namespaces) and attached to 486 | different modules introduce two names that are the same 487 | and that both have external linkage, the program is ill-formed; no 488 | diagnostic required. 489 | \enternote 490 | \grammarterm{using-declaration}{s}, typedef declarations, and 491 | \grammarterm{alias-declaration}{s} do not declare entities, but 492 | merely introduce synonyms. Similarly, \grammarterm{using-directive}{s} 493 | do not declare entities, either. 494 | \exitnote 495 | } 496 | \end{std.txt} 497 | 498 | 499 | \setcounter{section}{5} 500 | \rSec1[basic.start]{Start and termination} 501 | 502 | \setcounter{subsection}{0} 503 | \rSec2[basic.start.main]{\tcode{main} function} 504 | 505 | Modify paragraph 6.6.1/1 as follows: 506 | \begin{std.txt} 507 | \resetalinea[0] 508 | \alinea 509 | A program shall contain a global function called \tcode{main} 510 | \added{declared in the purview of the global module}. 511 | \end{std.txt} 512 | 513 | -------------------------------------------------------------------------------- /src/classes.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = std.tex 2 | \setcounter{chapter}{11} 3 | \rSec0[class]{Classes} 4 | 5 | \setcounter{section}{1} 6 | \rSec1[class.mem]{Class members} 7 | 8 | \setcounter{subsection}{3} 9 | \rSec2[class.bit]{Bit-fields} 10 | 11 | Modify paragraph 12.2.4/1 as follows: 12 | \begin{std.txt} 13 | \resetalinea[0] 14 | \alinea 15 | [...] The bit-field \removed{attribute}\added{semantic property} is not part of 16 | the type of the class member. [...] 17 | \end{std.txt} -------------------------------------------------------------------------------- /src/config.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | %%-------------------------------------------------- 3 | %% Version numbers 4 | \newcommand{\docno}{N4720} 5 | \newcommand{\prevdocno}{N4689} 6 | \newcommand{\cppver}{201703L} 7 | 8 | %% Title 9 | \newcommand{\doctitle}{Extensions to \Cpp for Modules} 10 | % \newcommand{\frtitle}{\Cpp Extensions for Networking} 11 | 12 | %% Release date 13 | %\newcommand{\reldate}{\today} 14 | \newcommand{\reldate}{2018-01-29} 15 | 16 | %% Library chapters 17 | -------------------------------------------------------------------------------- /src/cover-reg.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = std.tex 2 | %%-------------------------------------------------- 3 | %% Title page for the C++ Standard 4 | 5 | \def\frtitle{Extension C++ pour les modules} 6 | 7 | \thispagestyle{empty} 8 | {\raisebox{.35ex}{\smaller\copyright}}\,ISO 2018 --- All rights reserved 9 | \vspace{2ex} 10 | 11 | \begin{flushright} 12 | \textbf{ISO/IEC JTC1 SC22 WG21 N\,\LARGE 4719} 13 | 14 | Date: \reldate 15 | 16 | ISO/IEC TS 21544 17 | 18 | ISO/IEC JTC1 SC22 19 | 20 | Secretariat: ANSI 21 | 22 | \end{flushright} 23 | 24 | \vfill 25 | 26 | \textbf{\LARGE Programming Languages --- \doctitle} 27 | 28 | Langages de programmation --- \frtitle 29 | 30 | \vfill 31 | 32 | \begin{tabular}{|p{\hsize}|} 33 | \hline 34 | \begin{center} 35 | \textbf{Warning} 36 | \end{center} 37 | 38 | \vspace{2ex} 39 | 40 | This document is not an ISO International Standard. It is distributed 41 | for review and comment. It is subject to change without notice and may 42 | not be referred to as an International Standard.\\\\ 43 | 44 | Recipients of this draft are invited to submit, with their comments, 45 | notification of any relevant patent rights of which they are aware 46 | and to provide supporting documentation.\\\\ 47 | \hline 48 | \end{tabular} 49 | 50 | \vfill 51 | \noindent 52 | Document type: Technical Specification\\ 53 | Document stage: (30) Committee\\ 54 | Document Language: E 55 | \pagebreak 56 | 57 | \thispagestyle{cpppage} 58 | 59 | \begin{tabular}{|p{\hsize}|} 60 | \hline 61 | \begin{center} 62 | \textbf{Copyright notice} 63 | \end{center} 64 | 65 | \vspace{2ex} 66 | 67 | This ISO document is a working draft or committee draft and is 68 | copyright-protected by ISO. While the reproduction of working 69 | drafts or committee drafts in any form for use by participants 70 | in the ISO standards development process is permitted without 71 | prior permission from ISO, neither this document nor any extract 72 | from it may be reproduced, stored or transmitted in any form for 73 | any other purpose without prior written permission from ISO.\\\\ 74 | 75 | Requests for permission to reproduce this document for the 76 | purpose of selling it should be addressed as shown below or 77 | to ISO's member body in the country of the requester.\\\\ 78 | 79 | \begin{minipage}{\hsize} 80 | \begin{indented} 81 | ISO copyright office\\ 82 | Case postale 56, CH-1211 Geneva 20\\ 83 | Tel. + 41 22 749 01 11\\ 84 | Fax + 41 22 749 09 47\\ 85 | E-mail copyright@iso.org\\ 86 | Web www.iso.org 87 | \end{indented} 88 | \end{minipage} 89 | 90 | \vspace{2ex} 91 | 92 | Reproduction for sales purposes may be subject to royalty payments 93 | or a licensing agreement.\\\\ 94 | 95 | Violators may be prosecuted.\\\\ 96 | \hline 97 | \end{tabular} 98 | 99 | \newpage 100 | -------------------------------------------------------------------------------- /src/cover-wd.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | %%-------------------------------------------------- 3 | %% Title page for C++ Technical Specification 4 | 5 | 6 | \thispagestyle{empty} 7 | \begingroup 8 | \def\hd{\begin{tabular}{ll} 9 | \textbf{Document Number:} & {\larger\docno} \\ 10 | \textbf{Date:} & \reldate \\ 11 | \textbf{Revises:} & \prevdocno \\ 12 | \textbf{Reply to:} & Gabriel Dos~Reis \\ 13 | & Microsoft \\ 14 | & gdr@microsoft.com 15 | \end{tabular} 16 | } 17 | \newlength{\hdwidth} 18 | \settowidth{\hdwidth}{\hd} 19 | \hfill\begin{minipage}{\hdwidth}\hd\end{minipage} 20 | \endgroup 21 | 22 | \vspace{2.5cm} 23 | \begin{center} 24 | \textbf{\Huge 25 | Working Draft, Extensions to \Cpp for Modules} 26 | \end{center} 27 | \vfill 28 | \textbf{Note: this is an early draft. It's known to be incomplet and 29 | incorrekt, and it has lots of 30 | b\kern-1.2pta\kern1ptd\hspace{1.5em}for\kern-3ptmat\kern0.6ptti\raise0.15ex\hbox{n}g.} 31 | \newpage 32 | -------------------------------------------------------------------------------- /src/cxx.tex: -------------------------------------------------------------------------------- 1 | 2 | % Define section from the C++ standard that can be indexed 3 | % using its dotted identifer. That is: 4 | % 5 | % \cxxsec{basic.def.odr}{3.2} 6 | % 7 | % This is used to make references to sections of the C++ Standard 8 | % that are not labeled within this document. 9 | \newcommand{\cxxsec}[2]{% 10 | \expandafter\def\csname #1 \endcsname{#2}% 11 | } 12 | 13 | % Generate a reference to the section with the given id. This 14 | % expands to the full chapter/section/subsection number declared 15 | % by \cxxsec. For example: 16 | % 17 | % \cxxref{basic.def.odr} 18 | % 19 | % Expands to the string 3.2. 20 | \newcommand{\cxxref}[1]{% 21 | \csname #1 \endcsname% 22 | } 23 | 24 | \cxxsec{intro.compliance}{1.4} 25 | \cxxsec{intro.multithread}{1.10} 26 | 27 | \cxxsec{lex.key}{2.12} 28 | 29 | \cxxsec{basic.def.odr}{3.2} 30 | \cxxsec{basic.scope.namespace}{3.3.6} 31 | \cxxsec{basic.lookup}{3.4} 32 | \cxxsec{basic.types}{3.9} 33 | \cxxsec{basic.fundamental}{3.9.1} 34 | \cxxsec{basic.compound}{3.9.2} 35 | 36 | \cxxsec{conv}{4} 37 | 38 | \cxxsec{expr}{5} 39 | \cxxsec{expr.prim}{5.1} 40 | \cxxsec{expr.prim.general}{5.1.1} 41 | \cxxsec{expr.prim.lambda}{5.1.2} 42 | \cxxsec{expr.prim.req}{5.1.3} 43 | \cxxsec{expr.prim.fold}{5.1.4} 44 | \cxxsec{expr.typeid}{5.2.8} 45 | \cxxsec{expr.unary}{5.3} 46 | \cxxsec{expr.unaryOp}{5.3.1} 47 | \cxxsec{expr.pre.incr}{5.3.2} 48 | \cxxsec{expr.sizeof}{5.3.3} 49 | \cxxsec{expr.new}{5.3.4} 50 | \cxxsec{expr.delete}{5.3.5} 51 | \cxxsec{expr.alignof}{5.3.6} 52 | \cxxsec{expr.unary.noexcept}{5.3.7} 53 | \cxxsec{expr.cast}{5.4} 54 | \cxxsec{expr.mptr.oper}{5.5} 55 | \cxxsec{expr.mul}{5.6} 56 | \cxxsec{expr.add}{5.7} 57 | \cxxsec{expr.shift}{5.8} 58 | \cxxsec{expr.rel}{5.9} 59 | \cxxsec{expr.eq}{5.10} 60 | \cxxsec{expr.bit.and}{5.11} 61 | \cxxsec{expr.bit.xor}{5.12} 62 | \cxxsec{expr.bit.or}{5.13} 63 | \cxxsec{expr.log.and}{5.14} 64 | \cxxsec{expr.log.or}{5.15} 65 | \cxxsec{expr.cond}{5.16} 66 | \cxxsec{expr.ass}{5.17} 67 | \cxxsec{expr.comma}{5.18} 68 | \cxxsec{expr.const}{5.19} 69 | 70 | \cxxsec{stmt.block}{6.3} 71 | \cxxsec{stmt.select}{6.4} 72 | \cxxsec{stmt.iter}{6.5} 73 | \cxxsec{stmt.for}{6.5.3} 74 | 75 | \cxxsec{dcl.dcl}{7} 76 | \cxxsec{dcl.spec}{7.1} 77 | \cxxsec{dcl.fct.spec}{7.1.2} 78 | \cxxsec{dcl.constexpr}{7.1.5} 79 | \cxxsec{dcl.type}{7.1.6} 80 | \cxxsec{dcl.type.cv}{7.1.6.1} 81 | \cxxsec{dcl.type.simple}{7.1.6.2} 82 | \cxxsec{dcl.type.elab}{7.1.6.3} 83 | \cxxsec{dcl.spec.auto}{7.1.6.4} 84 | 85 | \cxxsec{dcl.decl}{8} 86 | \cxxsec{dcl.name}{8.1} 87 | \cxxsec{dcl.ambig.res}{8.2} 88 | \cxxsec{dcl.meaning}{8.3} 89 | \cxxsec{dcl.fct}{8.3.5} 90 | \cxxsec{dcl.fct.default}{8.3.6} 91 | \cxxsec{dcl.fct.def}{8.4} 92 | \cxxsec{dcl.fct.def.general}{8.4.1} 93 | \cxxsec{dcl.init.list}{8.5.4} 94 | 95 | \cxxsec{class}{9} 96 | \cxxsec{class.name}{9.1} 97 | \cxxsec{class.mem}{9.2} 98 | \cxxsec{class.static.data}{9.4.2} 99 | 100 | \cxxsec{class.derived}{10} 101 | \cxxsec{class.mi}{10.1} 102 | \cxxsec{class.member.lookup}{10.2} 103 | \cxxsec{class.virtual}{10.3} 104 | \cxxsec{class.abstract}{10.4} 105 | 106 | \cxxsec{class.ctor}{12.1} 107 | \cxxsec{class.dtor}{12.4} 108 | 109 | \cxxsec{over}{13} 110 | \cxxsec{over.load}{13.1} 111 | \cxxsec{over.dcl}{13.2} 112 | \cxxsec{over.match}{13.3} 113 | \cxxsec{over.match.funcs}{13.3.1} 114 | \cxxsec{over.match.viable}{13.3.2} 115 | \cxxsec{over.match.best}{13.3.3} 116 | \cxxsec{over.over}{13.4} 117 | \cxxsec{over.oper}{13.5} 118 | \cxxsec{over.call}{13.5.4} 119 | \cxxsec{over.built}{13.6} 120 | 121 | \cxxsec{temp}{14} 122 | \cxxsec{temp.param}{14.1} 123 | \cxxsec{temp.names}{14.2} 124 | \cxxsec{temp.arg}{14.3} 125 | \cxxsec{temp.arg.type}{14.3.1} 126 | \cxxsec{temp.arg.nontype}{14.3.2} 127 | \cxxsec{temp.arg.template}{14.3.3} 128 | \cxxsec{temp.type}{14.4} 129 | \cxxsec{temp.dcls}{14.5} 130 | \cxxsec{temp.class}{14.5.1} 131 | \cxxsec{temp.mem.func}{14.5.1.1} 132 | \cxxsec{temp.mem.class}{14.5.1.2} 133 | \cxxsec{temp.static}{14.5.1.3} 134 | \cxxsec{temp.mem.enum}{14.5.1.4} 135 | \cxxsec{temp.mem}{14.5.2} 136 | \cxxsec{temp.variadic}{14.5.3} 137 | \cxxsec{temp.friend}{14.5.4} 138 | \cxxsec{temp.class.spec.match}{14.5.5.1} 139 | \cxxsec{temp.class.order}{14.5.5.2} 140 | \cxxsec{temp.class.spec.mfunc}{14.5.5.3} 141 | \cxxsec{temp.fct}{14.5.6} 142 | \cxxsec{temp.over.link}{14.5.6.1} 143 | \cxxsec{temp.func.order}{14.5.6.2} 144 | \cxxsec{temp.res}{14.6} 145 | \cxxsec{temp.local}{14.6.1} 146 | \cxxsec{temp.dep}{14.6.2} 147 | \cxxsec{temp.dep.type}{14.6.2.1} 148 | \cxxsec{temp.dep.expr}{14.6.2.2} 149 | \cxxsec{temp.dep.constexpr}{14.6.2.3} 150 | \cxxsec{temp.dep.temp}{14.6.2.4} 151 | \cxxsec{temp.nondep}{14.6.2} 152 | \cxxsec{temp.dep.res}{14.6.3} 153 | \cxxsec{temp.inject}{14.6.4} 154 | \cxxsec{temp.spec}{14.7} 155 | \cxxsec{temp.inst}{14.7.1} 156 | \cxxsec{temp.explicit}{14.7.2} 157 | \cxxsec{temp.expl.spec}{14.7.3} 158 | 159 | \cxxsec{temp.deduct}{14.8.2} 160 | \cxxsec{temp.deduct.call}{14.8.2.1} 161 | \cxxsec{temp.deduct.funcaddr}{14.8.2.2} 162 | \cxxsec{temp.deduct.conv}{14.8.2.3} 163 | \cxxsec{temp.deduct.partial}{14.8.2.4} 164 | \cxxsec{temp.deduct.type}{14.8.2.5} 165 | \cxxsec{temp.deduct.decl}{14.8.2.6} 166 | 167 | \cxxsec{except}{15} 168 | \cxxsec{except.throw}{15.1} 169 | \cxxsec{except.ctor}{15.2} 170 | \cxxsec{except.handle}{15.3} 171 | \cxxsec{except.spec}{15.4} 172 | \cxxsec{except.special}{15.5} 173 | \cxxsec{except.terminate}{15.5.1} 174 | \cxxsec{except.unexpected}{15.5.2} 175 | \cxxsec{except.uncaught}{15.5.3} 176 | 177 | % Library 178 | 179 | \cxxsec{library}{17} 180 | \cxxsec{defns.block}{17.3.2} 181 | \cxxsec{description}{17.5} 182 | \cxxsec{structure.specifications}{17.5.1.4} 183 | \cxxsec{defaultconstructible}{17.6.3.1} 184 | \cxxsec{moveconstructible}{17.6.3.1} 185 | \cxxsec{copyconstructible}{17.6.3.1} 186 | \cxxsec{moveassignable}{17.6.3.1} 187 | \cxxsec{copyassignable}{17.6.3.1} 188 | \cxxsec{destructible}{17.6.3.1} 189 | \cxxsec{allocator.requirements}{17.6.3.5} 190 | \cxxsec{res.on.data.races}{17.6.5.9} 191 | \cxxsec{res.on.exception.handling}{17.6.5.12} 192 | 193 | \cxxsec{syserr}{19.5} 194 | 195 | \cxxsec{utilities}{20} 196 | \cxxsec{func.def}{20.9.1} 197 | \cxxsec{func.require}{20.9.2} 198 | \cxxsec{unord.hash}{20.9.12} 199 | \cxxsec{meta}{20.10} 200 | \cxxsec{meta.rqmts}{20.10.1} 201 | \cxxsec{meta.rel}{20.10.6} 202 | \cxxsec{time.clock.req}{20.12.3} 203 | 204 | \cxxsec{string.require}{21.4.1} 205 | 206 | \cxxsec{sequence.reqmts}{23.2.3} 207 | \cxxsec{vector}{23.3.6} 208 | 209 | \cxxsec{input.iterators}{24.2.3} 210 | \cxxsec{forward.iterators}{24.2.5} 211 | \cxxsec{bidirectional.iterators}{24.2.6} 212 | 213 | \cxxsec{thread.req.timing}{30.2.4} 214 | \cxxsec{thread.decaycopy}{30.2.6} 215 | \cxxsec{futures.state}{30.6.4} 216 | \cxxsec{futures.uniquefuture}{30.6.6} 217 | -------------------------------------------------------------------------------- /src/declarations.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = std.tex 2 | \setcounter{chapter}{9} 3 | \rSec0[dcl.dcl]{Declarations}% 4 | %\indextext{declaration|(} 5 | 6 | %gram: \rSec1[gram.dcl]{Declarations} 7 | %gram: 8 | 9 | \noindent 10 | Add a new alternative to \term{declaration} in paragraph 10/1 as follows 11 | \begin{std.txt} 12 | \begin{bnf} 13 | \nonterminal{declaration}:\br 14 | block-declaration\br 15 | nodeclspec-function-declaration\br 16 | function-definition\br 17 | template-declaration\br 18 | explicit-instantiation\br 19 | explicit-specialization\br 20 | linkage-specification\br 21 | namespace-definition\br 22 | empty-declaration\br 23 | attribute-declaration\br 24 | \color{addclr} 25 | \added{export-declaration\br 26 | module-import-declaration\br 27 | proclaimed-ownership-declaration} 28 | \end{bnf} 29 | \end{std.txt} 30 | 31 | 32 | \setcounter{section}{0} 33 | \rSec1[dcl.spec]{Specifiers}% 34 | 35 | \setcounter{subsection}{1} 36 | \rSec2[dcl.fct.spec]{Function specifiers}% 37 | 38 | \noindent 39 | Add a new paragraph 10.1.2/7 as follows: 40 | \begin{std.txt} 41 | \color{addclr} 42 | \resetalinea[6] 43 | \alinea 44 | \added{An exported inline function shall be defined in the same translation 45 | unit containing its export declaration. 46 | % That semantic property 47 | % is a reachable semantic property (\ref{dcl.module.reach}) even if 48 | % the definition is not exported (\ref{dcl.module.interface}). 49 | \enternote 50 | There is no restriction on the linkage (or absence thereof) 51 | of entities that the function body of an exported inline function 52 | can reference. A constexpr function (10.1.5) is implicitly inline. 53 | \exitnote} 54 | \end{std.txt} 55 | 56 | 57 | \setcounter{subsection}{5} 58 | \rSec6[dcl.inline]{The \tcode{inline} specifier}% 59 | 60 | \noindent 61 | Modify paragraph 10.1.6/6 as follows 62 | \begin{std.txt} 63 | \resetalinea[5] 64 | \alinea 65 | \added{Some definition for} 66 | \removed{A}\added{a}n inline function or variable shall be 67 | \removed{defined}\added{reachable} in every translation 68 | unit in which it is odr-used and \added{the function or variable} shall have exactly 69 | the same definition in every case (\ref{basic.link}). 70 | \enternote 71 | A call to the inline function or a use of 72 | the inline variable may be encountered before its definition appears 73 | in the translation unit. 74 | \exitnote 75 | If the definition of a function or variable appears in a translation unit 76 | before its first declaration as inline, the program is ill-formed. If a 77 | function or variable with external \added{or module} linkage is 78 | \removed{declared}\added{reachable via an} 79 | inline \added{declaration} in one translation 80 | unit, it shall be \removed{declared}\added{reachable via an} inline 81 | \added{declaration} in all translation units in which it 82 | \removed{appears}\added{is reachable}; 83 | no diagnostic is required. An inline function or variable with 84 | external \added{or module} linkage 85 | shall have the same address in all translation units. 86 | \enternote 87 | A \tcode{static} local variable in an inline function with external 88 | \added{or module} linkage always refers to the same object. A type 89 | defined within the body 90 | of an inline function with external \added{or module} linkage is the 91 | same type in every translation unit. 92 | \exitnote 93 | \end{std.txt} 94 | 95 | 96 | 97 | 98 | \setcounter{section}{2} 99 | \rSec1[basic.namespace]{Namespaces}% 100 | %\indextext{namespaces|(} 101 | 102 | \noindent 103 | Modify paragraph 10.3/1 as follows: 104 | \begin{std.txt} 105 | \resetalinea[0] 106 | \alinea 107 | A namespace is an optionally-named declarative region. The name of a 108 | namespace can be used to access entities declared in that namespace; 109 | that is, the members of the namespace. Unlike other declarative 110 | regions, the definition of a namespace can be split over several 111 | parts of one or more translation units. 112 | \added{A namespace with external linkage is always 113 | exported regardless of whether any of its \term{namespace-definition}{s} is 114 | introduced by \tcode{export}. 115 | \enternote 116 | There is no way to define a namespace with module linkage. 117 | \exitnote 118 | }\color{addclr} 119 | \begin{example} 120 | \begin{codeblock} 121 | export module M; 122 | namespace N { // N has external linkage and is exported 123 | } 124 | \end{codeblock} 125 | \end{example} 126 | \end{std.txt} 127 | 128 | \setcounter{subsection}{2} 129 | \rSec2[namespace.udecl]{The \tcode{using} declaration} 130 | 131 | Modify paragraph 10.3.3/1 as follows: 132 | \begin{std.txt} 133 | \resetalinea[0] 134 | \alinea 135 | Each \grammarterm{using-declarator} in a \grammarterm{using-declaration} 136 | introduces a set of declarations \added{and citations} into the declarative 137 | region in which the 138 | \grammarterm{using-declaration} appears. The set of declarations 139 | \added{and citations} 140 | introduced by 141 | the \grammarterm{using-declarator} is found by performing qualified name 142 | lookup (6.4.3, 13.2) for the name in the \grammarterm{using-declarator}, 143 | excluding functions that are hidden as described below. If the 144 | \grammarterm{using-declarator} does not name a constructor, the 145 | \grammarterm{unqualified-id} is declared in the declarative region in which 146 | the \grammarterm{using-declaration} appears as a synonym for each 147 | declaration \added{or citation} 148 | introduced by the \grammarterm{using-declarator}. [...] 149 | \end{std.txt} 150 | 151 | 152 | \noindent 153 | Add a new subclause 10.7 titled ``\textbf{Modules}'' as follows: 154 | 155 | \setcounter{section}{6} 156 | \rSec1[dcl.module]{Modules}% 157 | 158 | \rSec2[dcl.module.unit]{Module units and purviews} 159 | 160 | \begin{std.txt}\color{addclr} 161 | \begin{bnf}\color{addclr} 162 | \nonterminal{module-declaration}:\br 163 | \terminal{export}\opt {} \terminal{module} module-name attribute-specifier-seq\opt \terminal{;} 164 | \end{bnf} 165 | 166 | \begin{bnf}\color{addclr} 167 | \nonterminal{module-name}:\br 168 | module-name-qualifier-seq\opt identifier 169 | \end{bnf} 170 | 171 | \begin{bnf}\color{addclr} 172 | \nonterminal{module-name-qualifier-seq}:\br 173 | module-name-qualifier \terminal{.}\br 174 | module-name-qualifier-seq identifier \terminal{.} 175 | \end{bnf} 176 | 177 | \begin{bnf}\color{addclr} 178 | \nonterminal{module-name-qualifier}:\br 179 | identifier 180 | \end{bnf} 181 | 182 | \resetalinea[0] 183 | \alinea A \term{module unit} is a translation unit that contains 184 | a \grammarterm{module-declaration}. A \term{named module} is the 185 | collection of module units with the same \grammarterm{module-name}. 186 | A translation unit shall not contain more than 187 | one \grammarterm{module-declaration}. A \grammarterm{module-name} 188 | has external linkage but cannot be found by name lookup. 189 | 190 | \alinea 191 | A \term{module interface unit} is a module unit whose 192 | \grammarterm{module-declaration} contains the \texttt{export} keyword; 193 | any other module unit is a \term{module implementation unit}. A named 194 | module shall contain exactly one module interface unit. 195 | 196 | \alinea 197 | A \term{module unit purview} starts at the \grammarterm{module-declaration} 198 | and extends to the end of the translation unit. 199 | The \term{purview} of a named module \tcode{M} is the set of module unit purviews 200 | of \tcode{M}'s module units. 201 | 202 | \alinea 203 | The \term{global module} is the collection of all declarations 204 | not in the purview of any module. By 205 | extension, such declarations are said to be in the purview of the 206 | global module. 207 | \enternote 208 | The global module has no name, no module interface unit, and is not 209 | introduced by any 210 | \grammarterm{module-declaration}. 211 | \exitnote 212 | 213 | \alinea 214 | A \term{module} is either a named module or the global module. 215 | A \grammarterm{proclaimed-ownership-declaration} is 216 | \term{attached} to the module it nominates; any other declaration 217 | is attached to the module in whose purview it appears. 218 | 219 | \alinea 220 | For a namespace-scope declaration $D$ of an entity (other than a 221 | namespace), if $D$ is within a \grammarterm{proclaimed-ownership-declaration} 222 | for a module $X$, the entity is said to be \term{owned} by $X$. 223 | Otherwise, if $D$ is the first declaration of that entity, then that entity is said 224 | to be \term{owned} by the module in whose purview $D$ appears. 225 | 226 | \alinea 227 | If a declaration attached to some module 228 | matches (according to the redeclaration rules) a reachable declaration 229 | from a different module, 230 | the program is ill-formed. 231 | \begin{example} 232 | \begin{codeblock} 233 | // module interface of M 234 | int f(); // \#1 235 | int g(); // \#2, owned by the global module 236 | export module M; 237 | export using ::f; // OK: does not declare an entity 238 | int g(); // error: matches \#2, but appears in the purview of M 239 | export int h(); // \#3 240 | export int k(); // \#4 241 | 242 | // other translation unit 243 | import M; 244 | static int h(); // error: matches \#3 245 | int k(); // error: matches \#4 246 | \end{codeblock} 247 | \end{example} 248 | 249 | \alinea 250 | The subgraph of the abstract semantics graph $G$ of a module $M$ 251 | generated by the nodes of $G$, excluding those introducing names 252 | with internal linkage, is available to name lookup in the purview of every 253 | module implementation unit of $M$. 254 | The declsets made available by the \grammarterm{module-import-declaration}{s} 255 | in the purview of the module 256 | interface unit of $M$ are also available to name lookup in the purview of all 257 | module implementation units of $M$. 258 | \end{std.txt} 259 | 260 | \rSec2[dcl.module.interface]{Export declaration}% 261 | 262 | \begin{std.txt}\color{addclr} 263 | \begin{bnf}\color{addclr} 264 | \nonterminal{export-declaration}:\br 265 | \terminal{export} declaration\br 266 | \terminal{export} \terminal{\{} declaration-seq${}_{opt}$ \terminal{\}} 267 | \end{bnf} 268 | 269 | \resetalinea[0] 270 | \alinea 271 | An \grammarterm{export-declaration} shall only appear 272 | at namespace scope and only in the purview of a module interface unit. 273 | An \grammarterm{export-declaration} shall not appear directly 274 | or indirectly within an unnamed namespace. 275 | An \grammarterm{exported-declaration} 276 | has the declarative effects of its \grammarterm{declaration} 277 | or its \grammarterm{declaration-seq} (if any). 278 | An \grammarterm{export-declaration} does not 279 | establish a scope and shall not contain more than one 280 | \tcode{export} keyword. 281 | The \term{interface} of a module \tcode{M} is the set of all 282 | \grammarterm{export-declaration}{s} in its purview. 283 | 284 | \alinea 285 | In an \grammarterm{export-declaration} of the form 286 | \begin{grammar} 287 | @\tcode{export}@ @\term{declaration}@ 288 | \end{grammar} 289 | the \grammarterm{declaration} shall be a \grammarterm{module-import-declaration}, 290 | or it shall declare at least one name, 291 | and if that declaration declares an entity, the 292 | \grammarterm{decl-specifier-seq} (if any) of the 293 | \grammarterm{declaration} shall not contain \tcode{static}. 294 | The \grammarterm{declaration} shall not be an 295 | \grammarterm{unnamed-namespace-definition} 296 | or a \grammarterm{proclaimed-ownership-declaration}. 297 | \begin{example} 298 | \begin{codeblock} 299 | export int x; // error: not in the purview of a module interface unit 300 | export module M; 301 | namespace { 302 | export int a; // error: export within unnamed namespace 303 | } 304 | export static int b; // error: b explicitly declared static. 305 | export int f(); // OK 306 | export namespace N { } // OK 307 | export using namespace N; // error: does not declare a name 308 | \end{codeblock} 309 | \end{example} 310 | 311 | If the \grammarterm{declaration} is a \grammarterm{using-declaration} 312 | (\ref{namespace.udecl}), any entity to which the 313 | \grammarterm{using-declarator} ultimately refers shall have been introduced 314 | with a name having external linkage. 315 | \begin{example} 316 | \begin{codeblock} 317 | int f() // f has external linkage 318 | export module M; 319 | export using ::f; // OK 320 | struct S; 321 | export using ::S; // error: S has module linkage 322 | namespace N { 323 | int h(); 324 | static int h(int); // \#1 325 | } 326 | export using N::h; // error: \#1 has internal linkage 327 | \end{codeblock} 328 | \end{example} 329 | 330 | 331 | \enternote 332 | Names introduced by \tcode{typedef} declarations are not so constrained. 333 | \begin{example} 334 | \begin{codeblock} 335 | export module M; 336 | struct S; 337 | export using T = S; // OK: exports name T denoting type S 338 | \end{codeblock} 339 | \end{example} 340 | \exitnote 341 | 342 | \alinea 343 | 344 | An \grammarterm{export-declaration} of the form 345 | \begin{grammar} 346 | @\tcode{export}@ @\tcode{\{} \term{declaration-seq${}_{opt}$} \tcode{\}}@ 347 | \end{grammar} 348 | is equivalent to a sequence of declarations formed by prefixing each 349 | \grammarterm{declaration} of the \grammarterm{declaration-seq} (if any) with 350 | \tcode{export}. 351 | 352 | \alinea 353 | A namespace-scope or a class-scope declaration lexically 354 | contained in an \grammarterm{export-declaration}, as well as the 355 | entities and the names it introduces are said to be \term{exported}. 356 | The exported declarations in the interface of a module are reachable from 357 | any translation unit importing that module. 358 | \enternote 359 | Exported names have either external linkage or no linkage; see \ref{basic.link} 360 | \exitnote 361 | % The declarations introducing names with linkage 362 | % other than internal linkage introduced or made reachable 363 | % (via an \grammarterm{import-declaration}) 364 | % in the purview of the module 365 | % interface unit of a 366 | % module \tcode{M} are reachable from the purview of all module 367 | % implementation units 368 | % of \tcode{M}. 369 | \begin{example} 370 | \begin{codeblock} 371 | // Interface unit of M 372 | export module M; 373 | export struct X { 374 | void f(); 375 | struct Y { }; 376 | }; 377 | 378 | namespace { 379 | struct S { }; 380 | } 381 | export void f(S); // OK 382 | struct T { }; 383 | export T id(T); // OK 384 | 385 | export struct A; // A exported as incomplete 386 | 387 | export auto rootFinder(double a) { 388 | return [=](double x) { return (x + a/x)/2; }; 389 | } 390 | 391 | export const int n = 5; // OK: n has external linkage 392 | 393 | // Implementation unit of M 394 | module M; 395 | struct A { 396 | int value; 397 | }; 398 | 399 | // main program 400 | import M; 401 | int main() { 402 | X{}.f(); // OK: X and X::f are exported 403 | X::Y y; // OK: X::Y is exported as a complete type 404 | auto f = rootFinder(2); // OK 405 | return A{45}.value; // error: A is incomplete 406 | } 407 | \end{codeblock} 408 | \end{example} 409 | 410 | 411 | 412 | \alinea 413 | \enternote 414 | Redeclaring a name in an \grammarterm{export-declaration} 415 | cannot change the linkage of the name (10.1.1). 416 | \begin{example} 417 | \begin{codeblock} 418 | // Interface unit of M 419 | export module M; 420 | static int f(); // \#1 421 | export int f(); // error: \#1 gives internal linkage 422 | struct S; // \#2 423 | export struct S; // error: \#2 gives module linkage 424 | namespace { 425 | namespace N { 426 | extern int x; // \#3 427 | } 428 | } 429 | export int N::x; // error: \#3 gives internal linkage 430 | \end{codeblock} 431 | \end{example} 432 | \exitnote 433 | %% If the 434 | %% \term{export-declaration} introduces a function template or a variable 435 | %% template then the type of the corresponding current instantiation shall 436 | %% contain only types with external linkage. If the 437 | %% \term{export-declaration} introduces a template alias then the aliased 438 | %% type shall have external linkage. If the 439 | %% \term{export-declaration} defines a class template, then all 440 | %% non-internal members of the corresponding current instantiation shall 441 | %% contain only types with external linkage. 442 | 443 | %% \alinea 444 | %% In a \grammarterm{exported-fragment-group}, 445 | %% each \grammarterm{fragment} is processed 446 | %% as an exported declaration. 447 | 448 | \alinea 449 | Declarations in an exported \grammarterm{namespace-definition} 450 | or in an exported \grammarterm{linkage-specification} (10.5) 451 | are 452 | implicitly exported and subject to the rules of exported declarations. 453 | \begin{example} 454 | \begin{codeblock} 455 | export module M; 456 | export namespace N { 457 | int x; // OK 458 | static_assert(1 == 1); // error: does not declare a name 459 | } 460 | \end{codeblock} 461 | \end{example} 462 | \end{std.txt} 463 | 464 | 465 | \rSec2[dcl.module.import]{Import declaration}% 466 | 467 | \begin{std.txt}\color{addclr} 468 | \begin{bnf}\color{addclr} 469 | \nonterminal{module-import-declaration}:\br 470 | \terminal{import} module-name attribute-specifier-seq\opt {} \terminal{;} 471 | \end{bnf} 472 | 473 | \resetalinea[0] 474 | \alinea 475 | A \grammarterm{module-import-declaration} shall appear only at 476 | global scope, and not in a \grammarterm{linkage-specification} 477 | or \grammarterm{proclaimed-ownership-declaration}. 478 | A \grammarterm{module-import-declaration} nominating a module $M$ 479 | makes every citation and every exported declaration from the 480 | abstract semantics graph of $M$ available, as a citation, 481 | %makes exported declarations from the interface of the nominated module visible 482 | to name lookup in 483 | the current translation unit, in the same namespaces and contexts 484 | as in $M$. 485 | % the nominated module. 486 | A \term{citation} for a declaration attached to a module $M$ is a pair of 487 | $M$ and the corresponding declset from the abstract semantics graph 488 | of $M$. 489 | % The \grammarterm{attribute-specifier-seq} appartain to the nominated module. 490 | \enternote 491 | The declarations in the declsets and the entities denoted by the declsets 492 | are not redeclared in the translation unit 493 | containing the \grammarterm{module-import-declaration}. 494 | \exitnote 495 | \begin{example} 496 | \begin{Program} 497 | // Interface unit of M 498 | export module M; 499 | export namespace N { 500 | struct A { }; 501 | } 502 | namespace N { 503 | struct B { }; 504 | export struct C { 505 | friend void f(C) { } // exported, visible only through argument-dependent lookup 506 | }; 507 | } 508 | 509 | // Translation unit 2 510 | import M; 511 | N::A a { }; // OK. 512 | N::B b { }; // error: `B' not found in N. 513 | void h(N::C c) { 514 | f(c); // OK: `N::f' found via argument-dependent lookup 515 | N::f(c); // error: `f' not found via qualified lookup in N. 516 | } 517 | \end{Program} 518 | \end{example} 519 | 520 | \alinea 521 | A module \tcode{M1} \term{has a dependency} on a module \tcode{M2} 522 | if any module unit of \tcode{M1} contains a \grammarterm{module-import-declaration} 523 | nominating \tcode{M2}. A module shall not have a dependency on 524 | itself. 525 | \begin{example} 526 | \begin{codeblock} 527 | module M; 528 | import M; // error: cannot import M in its own unit. 529 | \end{codeblock} 530 | \end{example} 531 | 532 | \alinea 533 | A module \tcode{M1} \term{has an interface dependency} on a module 534 | \tcode{M2} if the module interface of \tcode{M1} contains a 535 | \grammarterm{module-import-declaration} nominating \tcode{M2}, 536 | or if there exists a module \tcode{M3} such that \tcode{M1} has an 537 | interface dependency on \tcode{M3} and \tcode{M3} has an interface dependency 538 | on \tcode{M2}. A module 539 | shall not have an interface dependency on itself. 540 | \begin{example} 541 | \begin{Program} 542 | // Interface unit of M1 543 | export module M1; 544 | import M2; 545 | 546 | // Interface unit of M2 547 | export module M2; 548 | import M3; 549 | 550 | // Interface unit of M3 551 | export module M3; 552 | import M1; // error: cyclic interface dependency M3 -> M1 -> M2 -> M3 553 | \end{Program} 554 | \end{example} 555 | 556 | \alinea 557 | A translation unit has an interface dependency on a module \tcode{M} if it is 558 | a module implementation unit of \tcode{M}, or if it contains a 559 | \grammarterm{module-import-declaration} nominating \tcode{M}, or if it has 560 | an interface dependency on a module that has an interface dependency on \tcode{M}. 561 | \end{std.txt} 562 | 563 | 564 | \rSec2[dcl.module.export]{Module exportation}% 565 | 566 | \begin{std.txt}\color{addclr} 567 | \resetalinea[0] 568 | \alinea 569 | An exported 570 | \grammarterm{module-import-declaration} nominating a module \tcode{M2} 571 | in the purview of a module interface unit of a module \tcode{M} 572 | makes all exported names 573 | of \tcode{M2} visible to any translation unit importing \tcode{M}, as if 574 | that translation unit also contains a \grammarterm{module-import-declaration} 575 | nominating \tcode{M2}. 576 | \enternote 577 | A module interface unit (for a module \tcode{M}) containing a non-exported 578 | \grammarterm{module-import-declaration} does not make the imported 579 | names transitively visible to translation units importing the module 580 | \tcode{M}. 581 | \exitnote 582 | % Wording requested by Hubert Tong on December 17, 2017. 583 | In addition to its usual semantics, a 584 | \grammarterm{module-import-declaration} nominating a module $M$ with 585 | a module interface unit containing one or more exported 586 | \grammarterm{module-import-declaration}{s} also behaves as if 587 | it nominates each module nominated by an exported 588 | \grammarterm{module-import-declaration} in $M$; this may in turn 589 | lead it to be considered to nominate yet additional modules. 590 | \end{std.txt} 591 | 592 | 593 | \rSec2[dcl.module.proclaim]{Proclaimed ownership declaration}% 594 | 595 | \begin{std.txt}\color{addclr} 596 | \begin{bnf}\color{addclr} 597 | \nonterminal{proclaimed-ownership-declaration}:\br 598 | \terminal{extern} \terminal{module} module-name \terminal{:} declaration 599 | \end{bnf} 600 | 601 | \resetalinea[0] 602 | \alinea 603 | A \grammarterm{proclaimed-ownership-declaration} shall only appear 604 | at namespace scope. 605 | It shall not appear directly or indirectly within an unnamed namespace. 606 | A \grammarterm{proclaimed-ownership-declaration} has the declarative effects 607 | of its \grammarterm{declaration}. 608 | The \grammarterm{declaration} shall declare at 609 | least one name, and the \grammarterm{decl-specifier-seq} (if any) 610 | of the \grammarterm{declaration} shall not contain \tcode{static}. 611 | The \grammarterm{declaration} shall not be a \grammarterm{namespace-definition}, 612 | an \grammarterm{export-declaration}, 613 | or a \grammarterm{proclaimed-ownership-declaration}. 614 | The \grammarterm{declaration} shall not be a defining declaration 615 | (\ref{basic.def}). 616 | A \grammarterm{proclaimed-ownership-declaration} nominating a module $M$ 617 | shall not appear in the purview of $M$. 618 | 619 | \alinea 620 | A \grammarterm{proclaimed-ownership-declaration} asserts that the entities 621 | introduced by the declaration are exported by the nominated module. 622 | \enternote 623 | A \grammarterm{proclaimed-ownership-declaration} may be used to break 624 | circular dependencies between two modules (in possibly too finely 625 | designed components.) 626 | \begin{example} 627 | \begin{codeblock} 628 | // TU 1 629 | export module Ty; 630 | extern module Sym: struct Symbol; 631 | export struct Type { 632 | Symbol* decl; 633 | // ... 634 | }; 635 | 636 | // TU 2 637 | export module Sym; 638 | extern module Ty: struct Type; 639 | export struct Symbol { 640 | const char* name; 641 | const Type* type; 642 | // ... 643 | }; 644 | \end{codeblock} 645 | \end{example} 646 | \exitnote 647 | 648 | \alinea 649 | The program is ill-formed, no diagnostic required, if the 650 | nominated module in the 651 | \grammarterm{proclaimed-ownership-declaration} does not export the entities 652 | introduced by the declaration. 653 | \end{std.txt} 654 | 655 | \rSec2[dcl.module.reach]{Reachability} 656 | 657 | \begin{std.txt}\color{addclr} 658 | \resetalinea[0] 659 | \alinea 660 | When declarations from the abstract semantics graph of a module $M$ 661 | are made available 662 | to name lookup in another translation unit $TU$, it is necessary to 663 | determine the interpretation of the names they introduce and their 664 | semantic properties. Except as noted below, the 665 | \term{reachable semantic properties} of declset $D$ 666 | (or of the entity, if any, denoted by that declset) 667 | of the abstract semantic graph of $M$ from $TU$ are 668 | \begin{itemize} 669 | \item if $D$ contains at least one exported declaration, 670 | the semantic properties cumulatively obtained in the context 671 | of the exported declaration (\ref{dcl.module.interface}) 672 | members of $D$ in the module interface 673 | unit of $M$. Furthermore, if $D$ denotes an inline function, 674 | the property that the inline function has a definition 675 | (\ref{dcl.fct.spec}) is a reachable semantic property, even 676 | if that definition is not exported. Otherwise, 677 | \item the semantic properties cumulatively obtained in the context of all 678 | declaration members of $D$ in the module interface unit of $M$. 679 | \end{itemize} 680 | % Given a declset $D$ for an exported name from a module $M$, 681 | % the \term{reachable semantic property} of any declaration in that declset 682 | % (or of the entity, if any, designated by that declset) from a translation unit 683 | %% For a given declaration $D$ of a name $X$ exported from a module $M$, the 684 | %% \term{reachable semantic properties} of $D$ from a translation unit 685 | % containing a \grammarterm{module-import-declaration} nominating $M$ are 686 | % restricted to 687 | % the semantic properties cumulatively obtained in 688 | % the context of the exported declaration members of $D$ in $M$. 689 | \enternote 690 | These reachable semantic properties include type completeness, 691 | type definitions, initializers, 692 | default arguments of functions or template declarations, attributes, 693 | visibility to normal lookup, entities that are direct targets of edges 694 | emanating from $D$ in the abstract semantics graph of $M$, etc. 695 | Since default arguments are evaluated in the context of the call expression, 696 | reachable semantic properties of the corresponding parameter types apply in 697 | that context. 698 | \begin{example} 699 | \begin{codeblock} 700 | // TU 1 701 | struct F { int f { 42 }; }; 702 | export module M; 703 | export using T = F; 704 | export struct A { int i; }; 705 | export int f(int, A = { 3 }); 706 | 707 | export struct B; // exported as incomplete type 708 | struct B { // definition not exported 709 | operator int(); 710 | }; 711 | export int g(B = B{}); 712 | export int h(int = B{}); // \#1 713 | 714 | export struct S { 715 | static constexpr int v(int); 716 | }; 717 | 718 | export S j(); // S attendant entity of j() 719 | constexpr int S::v(int x) { return 2 * x; } 720 | 721 | 722 | // TU 2 723 | import M; 724 | int main() { 725 | T t { }; // OK: reachable semantic properties of T include completeness. 726 | auto x = f(42); // OK: default argument A\{3\} evaluated here. 727 | auto y = h(); // OK: completeness of B only checked at \#1. 728 | auto z = g(); // error: parameter type incomplete here. 729 | constexpr auto a = decltype(j())::v(3); // OK: S::v defined 730 | // in the abstract semantics graph of M (\ref{dcl.fct.spec}) 731 | } 732 | \end{codeblock} 733 | \end{example} 734 | \exitnote 735 | 736 | \alinea 737 | Within a module interface unit, it is necessary to determine that the 738 | declarations being exported collectively present a coherent view of 739 | the semantic properties of the entities they reference. This determination 740 | is based on the semantic properties of attendant entities. 741 | \enternote 742 | The reachable semantics properties of an entity, the declarations of which 743 | are made available via a \grammarterm{module-import-declaration}, are 744 | determined by its owning module and are unaffected by the importing module. 745 | \begin{example} 746 | \begin{codeblock} 747 | // module interface of M1 748 | export module M1; 749 | export struct S { }; 750 | 751 | // module interface of M2 752 | import M1; 753 | export module M2; 754 | export S f(); // \#1 755 | export S* g(); // \#2 756 | 757 | // elsewhere 758 | import M2; 759 | auto x = f(); // OK: completeness of S obtained at \#1 760 | auto y = *g(); // OK: completeness of S obtained at \#2 761 | \end{codeblock} 762 | \end{example} 763 | \exitnote 764 | 765 | For each declaration $D$ exported from the module interface unit of a module $M$, 766 | there is a set of zero or more 767 | \term{attendant entities} defined as follows: 768 | \begin{itemize} 769 | \item If $D$ is a type alias declaration, then the attendant entities 770 | of $D$ are those determined by the aliased type at the point of the 771 | declaration $D$. 772 | 773 | \item If $D$ is a \grammarterm{using-declaration}, the set of attendant entities 774 | is the union of the sets of attendant entities of the declarations introduced by 775 | $D$ at the point of the declaration. 776 | 777 | \item If $D$ is a template declaration, the set of attendant entities is 778 | the union of the set of attendant entities 779 | of the declaration being parameterized, the set of attendant entities 780 | determined by the default type template arguments (if any), 781 | and the set consisting of 782 | the entities (if any) designated by the default template template argument, 783 | the default non-type template arguments (if any). 784 | 785 | \item if $D$ has a type $T$, the set of attendant entities is the set of 786 | attendant entities determined by $T$ at the point of declaration. 787 | 788 | \item Otherwise, the set of attendant entities is empty. 789 | \end{itemize} 790 | 791 | The \term{set of attendant entities determined by} a type $T$ is defined as follows 792 | (exactly one of these cases matches): 793 | \begin{itemize} 794 | \item If $T$ is a fundamental type, then 795 | the set of attendant entities is empty. 796 | 797 | % \item If $T$ is a dependent type denoted by a \grammarterm{typename-specifier} 798 | % where the \grammarterm{nested-name-specifier} itself denotes a dependent type, 799 | % then the set of attendant entities is the set of attendant entities determined by 800 | % that type. 801 | \item If $T$ is a member of an unknown specialization, the set of 802 | attendant entities is the set of attendant entities determined by that 803 | unknown specialization. 804 | 805 | \item If $T$ is a class type owned by $M$, the set of attendant entities includes 806 | $T$ itself, the union of the sets of the attendant entities determined 807 | by its direct base classes owned by $M$, the sets of the 808 | attendant entities of its data members, static data member templates, 809 | member functions, member function templates, 810 | the function parameters of its constructors and constructor templates. 811 | Furthermore, if $T$ is a 812 | class template specialization, the set of attendant entities also 813 | includes: the class template if it is owned by $M$, 814 | the union of the sets of attendant entities determined by the type 815 | template-arguments, the sets of the attendant entities of the templates 816 | used as template template-arguments, the sets of the attendant entities 817 | determined by the types of the non-type template-arguments. 818 | 819 | \item If $T$ is an enumeration type owned by $M$, 820 | the set of attendant entities is the singleton $\{T\}$. 821 | 822 | \item If $T$ is a reference to $U$, or a pointer to $U$, or an array of $U$, 823 | the set of attendant entities is the set of attendant entities determined by $U$. 824 | 825 | \item If $T$ is a function type, the set of attendant entities is the 826 | union of the set of attendant entities determined by the function 827 | parameter types and the return type. 828 | 829 | \item if $T$ is a pointer to data member of class $X$, the set of attendant 830 | entities is the union of the set of attendant entities of the member type 831 | and the set of attendant entities determined by $X$. 832 | 833 | \item If $T$ is a pointer to member function type of a class $X$, the 834 | set of attendant entities is the union of the set of attendant entities 835 | determined by $X$ and the set of attendant entities determined by 836 | the function type. 837 | 838 | \item Otherwise, the set of attendant entities is empty. 839 | \end{itemize} 840 | 841 | If a class template $X$ is an attendant entity, then its reachable semantic 842 | properties include all the declarations of the primary class template, 843 | its partial specializations, and its explicit specializations in the 844 | containing module interface unit. 845 | If a complete class type $X$ is an attendant entity, then its reachable 846 | semantic properties include the declarations of its nested types but 847 | not the definitions of the types denoted by those members 848 | unless those definitions are exported. 849 | Furthermore, if $X$ is an attendant entity of an 850 | exported declaration $D$, then its reachable semantic properties are 851 | restricted to those defined by the exported declarations of $X$ 852 | (if $X$ is introduced by an exported declaration), or by 853 | the semantic properties of $X$ available at the point of the declaration $D$. 854 | \enternote 855 | If $X$ is a complete class type that is an attendant entity, its nested types 856 | (including nested enumerations and associated enumerators) 857 | and member class templates 858 | are not considered attendant entities unless they are determined attendant 859 | entities by one of the rules above. Attendant entities allow type checking 860 | of direct member selection of an object even if that object's type isn't exported. 861 | Declarations, such as \grammarterm{asm-declaration} or 862 | \grammarterm{alias-declaration} or 863 | \grammarterm{static\_assert-declaration}, 864 | that do not declare entities do not contribute to the set of attendant entities. 865 | \exitnote 866 | \begin{example} 867 | \begin{codeblock} 868 | export module M; 869 | export struct Foo; // Foo exported as incomplete type 870 | struct Foo { }; 871 | export using ::Foo; // OK: exports complete type Foo 872 | 873 | struct C { }; 874 | struct S { 875 | struct B { }; 876 | using C = ::C; 877 | int i : 8; 878 | double d { }; 879 | }; 880 | 881 | export S f(); // S attendant entity of f(). 882 | 883 | // translation unit 2 884 | import M; 885 | int main() { 886 | int x = sizeof(decltype(f())::B); // error: incomplete B 887 | int y = sizeof(decltype(f())::C); // error: incomplete C 888 | decltype(f()) s { }; 889 | s.d = 3.14; // OK 890 | return &s.i != nullptr; // error: cannot take address of bitfield 891 | } 892 | \end{codeblock} 893 | \end{example} 894 | 895 | \alinea 896 | If $X$ is an attendant entity of two exported declarations 897 | designating two distinct entities, its reachable semantic properties shall 898 | be the same at the points where the declarations occur. 899 | \begin{example} 900 | \begin{codeblock} 901 | export module M; 902 | struct S; 903 | export S f(); // \#1 904 | struct S { }; 905 | export S g(); // error: class type S has different properties from \#1 906 | \end{codeblock} 907 | \end{example} 908 | 909 | \end{std.txt} 910 | 911 | -------------------------------------------------------------------------------- /src/definitions.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | 3 | \rSec0[intro.defs]{Terms and definitions} 4 | 5 | \setcounter{section}{1} 6 | \setcounter{tocdepth}{0} 7 | 8 | \setcounter{tocdepth}{1} 9 | 10 | No terms and definitions are listed in this document. 11 | 12 | ISO and IEC maintain terminological databases for use in standardization at 13 | the following addresses: 14 | \begin{itemize} 15 | \item ISO Online browsing platform: available at \url{https://www.iso.org/obp} 16 | \item IEC Electropedia: available at \url{http://www.electropedia.org} 17 | \end{itemize} 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/front.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | \input{cover-wd} 3 | %\input{cover-reg} 4 | 5 | %%-------------------------------------------------- 6 | %% The table of contents, list of tables, and list of figures 7 | \markboth{\contentsname}{} 8 | 9 | %%-------------------------------------------------- 10 | %% Make a bit more room for our long page numbers. 11 | \makeatletter 12 | \renewcommand\@pnumwidth{2.5em} 13 | \makeatother 14 | 15 | \begin{KeepFromToc} 16 | \tableofcontents 17 | \end{KeepFromToc} 18 | \setcounter{tocdepth}{5} 19 | 20 | %\newpage 21 | %\listoftables 22 | 23 | %% There are no figures in this TS. 24 | % \newpage 25 | % \listoffigures 26 | 27 | %\input{preface} 28 | -------------------------------------------------------------------------------- /src/general.tex: -------------------------------------------------------------------------------- 1 | 2 | \rSec0[intro]{General} 3 | 4 | 5 | \rSec1[intro.compliance]{Implementation compliance} 6 | 7 | \pnum 8 | Conformance requirements for this document are those 9 | defined in ISO 14882:2017, 4.1 10 | except that references to the C++ Standard therein shall 11 | be taken as referring to the document that is the result 12 | of applying the editing instructions. Similarly, all references 13 | to the C++ Standard in the resulting document shall be taken 14 | as referring to the resulting document itself. 15 | \enternote 16 | Conformance is defined in terms of the behavior of programs. 17 | \exitnote 18 | 19 | %% %% 20 | %% %% Feature-testing recommendations 21 | %% %% 22 | %% \rSec1[intro.features]{Feature-testing recommendations} 23 | 24 | %% \pnum 25 | %% An implementation that provides support for this Technical Specification shall 26 | %% define the feature test macro(s) in Table~\ref{tab:info.features}. 27 | 28 | %% \renewcommand{\thetable}{\Alph{table}} 29 | %% \begin{floattable}{Feature-test macro(s)}{tab:info.features} 30 | %% {ll} 31 | %% \topline 32 | %% \lhdr{Macro name} & \rhdr{Value} \\ 33 | %% \capsep 34 | %% \tcode{__cpp_concepts} & \tcode{201507} \\ 35 | %% \end{floattable} 36 | 37 | 38 | % \pnum 39 | % For the sake of improved portability between partial implementations of various 40 | % C++ standards, WG21 (the ISO Technical Committee for the \Cpp Programming 41 | % Language) recommends that implementers and programmers follow the guidelines in 42 | % this section concerning feature-test macros. 43 | % \enternote 44 | % WG21's SD-6 makes similar recommendations for the \Cpp Standard. 45 | % \exitnote 46 | 47 | % \pnum 48 | % Implementers who provide a new language feature should define a macro with the 49 | % recommended name, in the same circumstances under which the feature is available 50 | % (for example, taking into account relevant command-line options), to indicate 51 | % the presence of support for that feature. Implementers should define that macro 52 | % with the value specified in the most recent version of this Technical 53 | % Specification that they have implemented. The macro name for this Technical 54 | % Specification is \tcode{__cpp_experimental_concepts}, and its value is 55 | % \tcode{201501}. 56 | 57 | % \pnum 58 | % No header files should be required to test macros describing the presence 59 | % of support for language features. 60 | 61 | \rSec1[intro.ack]{Acknowledgments} 62 | 63 | 64 | \pnum 65 | This document is based, in part, on the design and implementation 66 | described in the paper P0142R0 ``\emph{A Module System for C++}''. 67 | -------------------------------------------------------------------------------- /src/layout.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | %% layout.tex -- set overall page appearance 3 | 4 | %%-------------------------------------------------- 5 | %% set page size, type block size, type block position 6 | 7 | \setstocksize{11in}{8.5in} 8 | \settrimmedsize{11in}{8.5in}{*} 9 | \setlrmarginsandblock{1in}{1in}{*} 10 | \setulmarginsandblock{1in}{*}{1.618} 11 | 12 | %%-------------------------------------------------- 13 | %% set header and footer positions and sizes 14 | 15 | \setheadfoot{\onelineskip}{2\onelineskip} 16 | \setheaderspaces{*}{2\onelineskip}{*} 17 | 18 | %%-------------------------------------------------- 19 | %% make miscellaneous adjustments, then finish the layout 20 | \setmarginnotes{7pt}{7pt}{0pt} 21 | \checkandfixthelayout 22 | 23 | %%-------------------------------------------------- 24 | %% Paragraph and bullet numbering 25 | 26 | \newcounter{Paras} 27 | \counterwithin{Paras}{chapter} 28 | \counterwithin{Paras}{section} 29 | \counterwithin{Paras}{subsection} 30 | \counterwithin{Paras}{subsubsection} 31 | \counterwithin{Paras}{paragraph} 32 | \counterwithin{Paras}{subparagraph} 33 | 34 | \newcounter{Bullets1}[Paras] 35 | \newcounter{Bullets2}[Bullets1] 36 | \newcounter{Bullets3}[Bullets2] 37 | \newcounter{Bullets4}[Bullets3] 38 | 39 | \makeatletter 40 | \newcommand{\parabullnum}[2]{% 41 | \stepcounter{#1}% 42 | \noindent\makebox[0pt][l]{\makebox[#2][r]{% 43 | \scriptsize\raisebox{.7ex}% 44 | {% 45 | \ifnum \value{Paras}>0 46 | \ifnum \value{Bullets1}>0 (\fi% 47 | \arabic{Paras}% 48 | \ifnum \value{Bullets1}>0 .\arabic{Bullets1}% 49 | \ifnum \value{Bullets2}>0 .\arabic{Bullets2}% 50 | \ifnum \value{Bullets3}>0 .\arabic{Bullets3}% 51 | \fi\fi\fi% 52 | \ifnum \value{Bullets1}>0 )\fi% 53 | \fi% 54 | }% 55 | \hspace{\@totalleftmargin}\quad% 56 | }}} 57 | \makeatother 58 | 59 | \def\pnum{\parabullnum{Paras}{0pt}} 60 | 61 | % Leave more room for section numbers in TOC 62 | \cftsetindents{section}{1.5em}{3.0em} 63 | 64 | % For compatibility only. We no longer need this environment. 65 | \newenvironment{paras}{}{} 66 | 67 | 68 | %% This is used to number paragraphs in ISO C++ standard text, e.g. 69 | %% 3 blah blah ... 70 | %% blah .... ... 71 | \newcounter{alinea}[section] 72 | \renewcommand{\thealinea}{\arabic{alinea}} 73 | \newcommand{\alinea}{% 74 | \ifhmode\par\fi\vskip.5em\noindent 75 | \refstepcounter{alinea}% 76 | \llap{\thealinea\hspace{2ex}}% 77 | } 78 | 79 | \newcommand{\resetalinea}[1][0]{% 80 | \setcounter{alinea}{#1}% 81 | } 82 | 83 | 84 | \lstnewenvironment{grammar} 85 | {\lstset{basicstyle=\rmfamily,columns=fullflexible,escapechar=@}} 86 | {} 87 | 88 | 89 | %% This is used to typeset section headings of ISO C++ standard text, e.g. 90 | %% x.y.x Foo bar [foo.bar] 91 | \newcounter{myclause} 92 | \newcounter{mysection}[myclause] 93 | \newcounter{mysubsection}[mysection] 94 | \makeatletter 95 | \renewcommand{\themysection}% 96 | {\arabic{myclause}} 97 | \renewcommand{\themysection}% 98 | {\themyclause.\arabic{mysection}} 99 | \renewcommand{\themysubsection}% 100 | {\themyclause.\themysection.\arabic{mysubsection}} 101 | \newcommand{\mysection}[2]{\@startsection{mysection}{2}{\z@}% 102 | {-3.25ex \@plus -1ex \@minus -.2ex}% 103 | {1.ex \@plus.2ex}% 104 | {\normalfont\bfseries}[#1]{#1 \hfill [#2]}} 105 | \makeatother 106 | 107 | \newenvironment{std.txt}% 108 | {\begin{quote}\fontsize{9pt}{10pt}\fontfamily{pbk}\selectfont}% 109 | {\end{quote}} 110 | -------------------------------------------------------------------------------- /src/lexical.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | 3 | \rSec0[lex]{Lexical conventions} 4 | 5 | \setcounter{section}{0} 6 | \Sec1[lex.separate]{Separate translation} 7 | 8 | Modify paragraph 5.1/2 as follows 9 | \begin{std.txt} 10 | \resetalinea[1] 11 | \alinea 12 | \enternote 13 | Previously translated translation units and instantiation units can be 14 | preserved individually or in libraries. The separate translation units of 15 | a program communicate (\ref{basic.link}) by (for example) calls to functions whose 16 | identifiers have external \added{or module} linkage, manipulation of objects whose 17 | identifiers have external \added{or module} linkage, or manipulation of data files. 18 | Translation units can be separately translated and then later linked to produce 19 | an executable program (\ref{basic.link}). 20 | \exitnote 21 | 22 | \end{std.txt} 23 | 24 | 25 | \Sec1[lex.phases]{Phases of translation} 26 | 27 | \noindent 28 | Modify bullet 7 of paragraph 5.2/1 as follows: 29 | \begin{std.txt} 30 | % \resetalinea[6] 31 | % \alinea 32 | \begin{itemize} 33 | \item[7.] 34 | White-space characters separating tokens are no longer significant. 35 | Each preprocessing token is converted into a token (5.6). 36 | The resulting tokens are syntactically and semantically analyzed and 37 | translated as a translation unit. 38 | \enternote 39 | The process of analyzing and translating the tokens may occasionally 40 | result in one token being replaced by a sequence of other tokens (17.2). 41 | \exitnote 42 | \added{It is implementation-defined whether the source for module interface 43 | units for modules on which the current translation unit has an interface 44 | dependency (\ref{dcl.module.import}) is required to be available.} 45 | \enternote 46 | Source files, translation units and translated translation units need not 47 | necessarily be stored as files, nor need there be any one-to-one 48 | correspondence between these entities and any external representation. 49 | The description is conceptual only, and does not specify any particular 50 | implementation. 51 | \exitnote 52 | \end{itemize} 53 | \end{std.txt} 54 | 55 | 56 | Add new paragraphs as follows: 57 | \begin{std.txt}\color{addclr} 58 | \resetalinea[1] 59 | \alinea 60 | The result of processing a translation unit from phases 1 through 7 61 | is a directed graph called the \term{abstract semantics graph} of 62 | the translation unit: 63 | \begin{itemize} 64 | \item Each vertex, called a \term{declset}, is 65 | a citation (\ref{dcl.module.import}), or a collection of 66 | non-local declarations and redeclarations (Clause \ref{dcl.dcl}) 67 | declaring the same entity or other non-local declarations 68 | of the same name that do not declare an entity. 69 | \item A directed edge $(D_1, D_2)$ exists in the graph if and only if the 70 | declarations contained in $D_2$ declare an entity mentioned 71 | in a declaration contained in $D_1$. 72 | \end{itemize} 73 | The \term{abstract semantics graph of a module} is the subgraph of 74 | the abstract semantics graph of its module interface unit generated 75 | by the declsets the declarations of which are 76 | in the purview of that module interface unit. 77 | \enternote 78 | The abstract semantics graphs of modules, 79 | as appropriately restricted (\ref{dcl.module.reach}), are used in 80 | the processing of \grammarterm{module-import-declaration}{s} 81 | (\ref{dcl.module.import}) and module implementation units. 82 | \exitnote 83 | 84 | \alinea 85 | An entity is \term{mentioned} in a declaration $D$ if that entity is a member of the 86 | \term{basis} of $D$, a set of entities determined as follows: 87 | \begin{itemize} 88 | \item If $D$ is a \grammarterm{namespace-definition}, the basis is the union 89 | of the bases of the \grammarterm{declaration}{s} in its 90 | \grammarterm{namespace-body}. 91 | 92 | \item If $D$ is a \grammarterm{nodeclspec-function-declaration}, 93 | \begin{itemize} 94 | \item if $D$ declares a contructor, the basis is 95 | the union of the type-bases of the parameter types 96 | 97 | \item if $D$ declares a conversion function, the basis is 98 | the type-basis of the return type 99 | 100 | \item otherwise, the basis is empty. 101 | \end{itemize} 102 | 103 | \item If $D$ is a \grammarterm{function-definition}, the basis is 104 | the type-basis of the function's type 105 | 106 | \item If $D$ is a \grammarterm{simple-declaration} 107 | \begin{itemize} 108 | \item if $D$ declares a \grammarterm{typedef-name}, the basis is the 109 | type-basis of the aliased type 110 | \item if $D$ declares a variable, the basis is the type-basis 111 | of the type of that variable 112 | \item if $D$ declares a function, the basis is the type-basis of the type of that function 113 | \item if $D$ defines a class type, the basis is the union of the 114 | type-bases of its direct base classes (if any), and the bases of 115 | its \grammarterm{member-declaration}{s}. 116 | \item otherwise, the basis is the empty set. 117 | \end{itemize} 118 | 119 | \item If $D$ is a \grammarterm{template-declaration}, the basis is the union 120 | of the basis of its \grammarterm{declaration}, the set 121 | consisting of the entities (if any) designated by the default 122 | template template arguments, the default non-type template arguments, the 123 | type-bases of the default type template arguments. 124 | Furthermore, if $D$ declares a 125 | partial specialization, the basis also includes the primary template. 126 | 127 | \item If $D$ is an \grammarterm{explicit-instantiation} 128 | or an \grammarterm{explicit-specialization}, the basis includes 129 | the primary template, and all the entities in the basis of the 130 | \grammarterm{declaration} of $D$. 131 | 132 | \item If $D$ is a \grammarterm{linkage-specification}, the basis is the union 133 | of all the bases of the \grammarterm{declaration}{s} contained in $D$. 134 | 135 | \item If $D$ is a \grammarterm{namespace-alias-definition}, the basis is the 136 | singleton consisting of the namespace denoted by the 137 | \grammarterm{qualified-namespace-specifier}. 138 | 139 | \item If $D$ is a \grammarterm{using-declaration}, the basis is the union 140 | of the bases of all the declarations introduced by 141 | the \grammarterm{using-declarator}. 142 | 143 | \item If $D$ is a \grammarterm{using-directive}, the basis is the 144 | singleton consisting of the norminated namespace. 145 | 146 | \item If $D$ is an \grammarterm{alias-declaration}, the basis is the type-basis of 147 | its \grammarterm{defining-type-id}. 148 | 149 | \item Otherwise, the basis is empty. 150 | \end{itemize} 151 | 152 | The \term{type-basis} of a type $T$ is 153 | \begin{itemize} 154 | \item If $T$ is a fundamental type, the type-basis is the empty set. 155 | \item If $T$ is a cv-qualified type, the type-basis is the type-basis of 156 | the unqualified type. 157 | \item If $T$ is a member of an unknown specialization, the type-basis 158 | is the type-basis of that specialization. 159 | \item If $T$ is a class template specialization, the type-basis 160 | is the union of the set consisting of the primary template and the 161 | template template arguments (if any) and the non-dependent non-type 162 | template arguments (if any), and the type-bases of the type 163 | template arguments (if any). 164 | \item If $T$ is a class type or an enumeration type, 165 | the type-basis is the singleton $\{ T \}$. 166 | \item If $T$ is a reference to $U$, or a pointer to $U$, or an array of $U$, the 167 | type-basis is the type-basis of $U$. 168 | \item If $T$ is a function type, the type-basis is the union of the 169 | type-basis of the return type and the type-bases of the parameter types. 170 | \item If $T$ is a pointer to data member of a class $X$, the type-basis is 171 | the union of the type-basis of $X$ and the type-basis of member type. 172 | \item If $T$ is a pointer to member function type of a class $X$, the 173 | type-basis is the union of the type-basis of $X$ and the type-basis of 174 | the function type. 175 | \item Otherwise, the type-basis is the empty set. 176 | \end{itemize} 177 | 178 | % The \term{expr-basis} of an expression $E$ is 179 | % \begin{itemize} 180 | % \item If $E$ is a pair of \grammarterm{expression} separated by a comma, 181 | % the expr-basis is the union of the expr-bases of the two operands. 182 | 183 | % \item If $E$ is an assignment, the expr-basis is the union of the 184 | % expr-bases of the left operand and the right operand, and the set consisting 185 | % of the function implementing the assignment operator (if the left operand 186 | % if of class type) and all the functions involved in the implicit conversion 187 | % sequences applied to the operands. 188 | 189 | % \item If $E$ is a \grammarterm{throw-expression}, the expr-basis is the 190 | % expr-basis of its operand. 191 | 192 | % \item If $E$ is a \grammarterm{conditional-expression}, the expr-basis is the 193 | % union of the expr-bases of all the operands, and the set of functions involved 194 | % in the implicit conversion sequences applied to the operands. 195 | 196 | % \item If $E$ is a binary expression, the expr-basis is the union of the 197 | % expr-bases of the two operands, and the set of functions involved in the 198 | % implicit conversion sequences applied to the operands, and the function 199 | % selected by overload resolution (if any) for the operator. 200 | 201 | % \item If $E$ is an explicit type conversion expression, the expr-basis is 202 | % the union of the type-basis of the target type and the expr-basis of 203 | % the operand expression, and the set consisting of the function or constructor 204 | % involved in performing the conversion to the target type (if any). 205 | 206 | % \item If $E$ is a \grammarterm{noexcept-expression}, 207 | % the expr-basis is the expr-basis of the operand. 208 | 209 | % \item If $E$ is an alignof expression, 210 | % the expr-basis is the type-basis of that operand. 211 | 212 | % \item If $E$ is a \grammarterm{delete-expression}, the expr-basis is 213 | % the union of the expr-basis of the operand and the set consisting of 214 | % the functions inolved in the implicit conversion sequence 215 | % applied to the operand, and the deallocation function selected. 216 | 217 | % \item If $E$ is a \grammarterm{new-expression}, the expr-basis is 218 | % the union of 219 | % \begin{itemize} 220 | % \item the expr-bases of the expressions in its 221 | % \grammarterm{new-placement} (if any), and the set of 222 | % functions involved in the implicit conversion sequences applied 223 | % to those expressions (if any), and the allocation function selected 224 | % \item the type-basis of the \grammarterm{type-specifier-seq} contained 225 | % in the \grammarterm{new-type-id}, the expr-bases of the expressions 226 | % contained in the \grammarterm{new-declarator} (if any), and the set 227 | % consisting of the functions involved in the implicit conversion sequences 228 | % applied to those expressions 229 | % \item the expr-bases of the expressions contained in the 230 | % \grammarterm{new-initializer} (if any), and the set consisting of the 231 | % functions involved in the implicit conversion sequences applied 232 | % to those expressions and the constructor selected (if any) 233 | % \end{itemize} 234 | 235 | % \item If $E$ is a sizeof expression, the expr-basis is the expr-basis 236 | % of the operand if the operand is an expression, otherwise the type-basis 237 | % of the operand. 238 | 239 | % \item If $E$ is prefix expression or a postfix expression, the expr-basis 240 | % is the expr-basis of the operand, and the set consisting of the 241 | % operator function selected by overload resolution (if any). 242 | 243 | % \item If $E$ is a pointer to member expression, the expr-basis is the 244 | % set consisting of the designated non-static member. 245 | 246 | % \item If $E$ is any other unary expression, the expr-basis is the 247 | % union of the expr-basis of the operand expression, and the set 248 | % consisting of the operator function (if any) selected by overload 249 | % resolution and any functions involved in the implicit conversion 250 | % sequence applied to the operand expression. 251 | 252 | % \item if $E$ is a \grammarterm{postfix-expression} 253 | % \begin{itemize} 254 | % \item and is a typeid expression, the expr-basis is the 255 | % type-basis of the type operand if the operand is a type, or the 256 | % expr-basis of the expression operand 257 | 258 | % \item and is a cast expression, the expr-basis is the union of the 259 | % the type-basis of the target type, the expr-basis of the expression operand, 260 | % and the set consisting of function or constructor involved in the 261 | % conversion of the expression operand to the target type 262 | 263 | % \item and is a postifx increment or decrement expression, the expr-basis is 264 | % the expr-basis of the operand expression, and the set consisting of the 265 | % operator function (if any) selected by overload resolution 266 | 267 | % \item and is a pseudo destructor call, the expr-basis is the expr-basis 268 | % of the left-hand side of the dot or arrow operator 269 | 270 | % \item and is a class member access expression, the expr-basis is the union 271 | % of the left-hand expression operand of the dot or the arrow operator, 272 | % and (if that left-hand side is not type-dependent) the set consisting of 273 | % the class member designated by the \grammarterm{id-expression}, the 274 | % operator function selected by overload resolution for the member access 275 | % operator 276 | 277 | % \item and is a function call expression, the expr-basis is the union of 278 | % the expr-basis of the \grammarterm{postfix-expression}, the expr-bases 279 | % of the arguments (if any), and the set consisting of the operator function 280 | % implementing the call selected by overload resolution, all the functions 281 | % involved in the implicit conversion sequences applied to each argument 282 | % in the call 283 | 284 | % \item and is a subscripting expression, the expr-basis is the union of 285 | % the expr-basis of the \grammarterm{postfix-expression}, and the expr-bases 286 | % of each expression in the \grammarterm{expr-or-braced-init-list} 287 | 288 | % \item otherwise, the expr-basis is the empty set. 289 | % \end{itemize} 290 | 291 | % \item If $E$ is a primay expression, 292 | % \begin{itemize} 293 | % \item and is a literal, the expr-basis is... 294 | % \item and is an \grammarterm{id-expression}, the expr-basis is the set 295 | % consisting of the designated entity (if it has namespace scope 296 | % or class scope) or the non-static class member; otherwise the class is empty 297 | % \item and is a parentesized expression, the expr-basis is the expr-basis 298 | % of that expression 299 | % \item and is a lambda expression, the expr-basis is the union of 300 | % \begin{itemize} 301 | % \item the type-bases in the parameter types (if any) 302 | % \item the type-basis of the \grammarterm{trailing-return-type} (if any) 303 | % \item the expr-basis of the \grammarterm{initializer}{s} (if any) 304 | % in its \grammarterm{lambda-capture}. 305 | % \end{itemize} 306 | % \end{itemize} 307 | 308 | % \item Otherwise, the expr-basis is the empty set. 309 | 310 | % \end{itemize} 311 | 312 | % The \term{expr-basis} of an expression $E$ is 313 | % \begin{itemize} 314 | % \item If $E$ is a \grammarterm{literal} 315 | % \begin{itemize} 316 | % \item the set consisting of the literal operator function called, if 317 | % $E$ is a \grammarterm{user-defined-literal}; otherwise 318 | % \item the empty set. 319 | % \end{itemize} 320 | 321 | % \item If $E$ is a parenthesized expression, the expr-basis is the expr-basis 322 | % of that expression. 323 | 324 | % \item If $E$ is a \grammarterm{id-expression} 325 | % \begin{itemize} 326 | % \item the set consisting of the designated destructor, 327 | % if $E$ denotes a destructor; otherwise, 328 | % \item the union of the set consisting of the template, the template 329 | % template-arguments (if any), the type-bases of the type 330 | % template-argumnts (if any), the expr-bases of the non-type 331 | % template-arguments (if any), if $E$ is a \grammarterm{template-id}; otherwise, 332 | % \item the set consisting of the namespace scope or class scope entity 333 | % designated by $E$ if $E$ denotes such an entity; otherwise, 334 | % \item the empty set. 335 | % \end{itemize} 336 | 337 | % \item If $E$ is a \grammarterm{lambda-expression}, the union of 338 | % \begin{itemize} 339 | % \item the type-bases in the parameter types (if any) 340 | % \item the type-basis of the \grammarterm{trailing-return-type} (if any) 341 | % \item the expr-basis of the expressions in the 342 | % \grammarterm{initializer}{s} (if any) 343 | % in its \grammarterm{lambda-capture}. 344 | % \end{itemize} 345 | 346 | % \item If $E$ is a \grammarterm{fold-expression}, the union 347 | % of the expr-bases of the operands, and the set of operator functions 348 | % found by name lookup for the \grammarterm{fold-operator}{s} in the 349 | % context of $E$. 350 | 351 | % \item The empty set, if $E$ is any other \grammarterm{primary-expression}. 352 | 353 | % \item If $E$ is a subscripting expression, the union of the expr-basis 354 | % of the \grammarterm{postfix-expression}, the expr-bases of the 355 | % expressions contained in the \grammarterm{expr-or-braced-init-list}, and 356 | % the set consisting of the selected overloaded operator function (if any) 357 | % and all functions involved in the implicit conversion sequences (if any) 358 | % applied to those expressions. 359 | 360 | % \item If $E$ is a function call expression, the union of the expr-basis 361 | % of the \grammarterm{postfix-expression}, the expr-bases of the expressions 362 | % in the argument list, the set consisting of the selected overloaded function 363 | % operator (if any) and the functions involved in the 364 | % implicit conversion sequences (if any) applied to the arguments, 365 | % and the set of functions found by name lookup in the context of $E$ if 366 | % the \grammarterm{postfix-expression} is a dependent name. 367 | 368 | % \item If $E$ is an explicit type conversion using functional notation, 369 | % the union of the type-basis of the target type, the expr-bases of the 370 | % expressions in the \grammarterm{expression-list} or 371 | % \grammarterm{brace-init-list}, the set consisting of the 372 | % constructor selected (if any) and all functions involved in 373 | % the implicit conversion sequences (if any) applied to the arguments. 374 | 375 | % \item If $E$ is a member selection expression, the union of the expr-basis 376 | % of the \grammarterm{postfix-expression} and the set consisting of 377 | % the overloaded function operator (if any) and the entity member (if any) 378 | % designated by the \grammarterm{id-expression}. 379 | 380 | % \item If $E$ is a named cast expression, the union of the type-basis 381 | % of the target type, the expr-basis of the operand expression, the 382 | % set consisting of the function or constructor selected to perform 383 | % the conversion and the function involved in the implicit conversion 384 | % sequence (if any) applied to the operand. 385 | 386 | % \item If $E$ is a post-increment or post-decrement expression, the 387 | % union of the expr-basis of the \grammarterm{postfix-expression}, and the 388 | % set consisting the selected function operator (if any). 389 | 390 | % \item If $E$ is a pseudo destructor call, the expr-basis of 391 | % the \grammartem{postfix-expression}. 392 | 393 | % \item If $E$ is a typeid expression, the expr-basis of the operand if 394 | % that operand is an expression, otherwise the type-basis of that operand. 395 | 396 | % \item The empty set, if $E$ is any other 397 | % \grammarterm{postfix-expression}. 398 | 399 | % \item Otherwise, the empty set. 400 | %\end{itemize} 401 | 402 | \alinea 403 | \enternote 404 | The basis of a declaration includes neither non-fully evaluated expressions nor 405 | entities used in those expressions. 406 | \begin{example} 407 | \begin{codeblock} 408 | const int size = 2; 409 | int ary1[size]; // \tcode{size} not in \tcode{ary1}'s basis 410 | constexpr int identity(int x) { return x; } 411 | int ary2[identity(2)]; // \tcode{identity} not in \tcode{ary2}'s basis 412 | 413 | template struct S; 414 | template struct S2; 415 | constexpr int g(int); 416 | 417 | template 418 | S> f(); // \tcode{f}'s basis: $\{ \mathtt{S}, \mathtt{S2} \}$ 419 | \end{codeblock} 420 | \end{example} 421 | \exitnote 422 | 423 | \end{std.txt} 424 | 425 | 426 | \setcounter{section}{10} 427 | \Sec1[lex.key]{Keywords} 428 | 429 | In \ref{lex.key}, add these two keywords to Table 5 in paragraph 430 | 5.11/1: \added{module} and \added{import}. 431 | 432 | \noindent 433 | Modify note in paragraph \ref{lex.key}/1 as follows: 434 | \begin{std.txt} 435 | \resetalinea[0] 436 | \alinea 437 | ... 438 | 439 | 440 | \enternote 441 | The \removed{\tcode{export} and} \tcode{register} keyword\removed{s are} \added{is} 442 | unused but \removed{are} \added{is} 443 | reserved for future use. 444 | \exitnote 445 | \end{std.txt} -------------------------------------------------------------------------------- /src/macros.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = std.tex 2 | % Definitions and redefinitions of special commands 3 | 4 | %%-------------------------------------------------- 5 | %% Difference markups 6 | \definecolor{addclr}{rgb}{0,.6,.6} 7 | \definecolor{remclr}{rgb}{1,0,0} 8 | \definecolor{noteclr}{rgb}{0,0,1} 9 | 10 | \renewcommand{\added}[1]{\textcolor{addclr}{\uline{#1}}} 11 | \newcommand{\removed}[1]{\textcolor{remclr}{\sout{#1}}} 12 | \renewcommand{\changed}[2]{\removed{#1}\added{#2}} 13 | 14 | \newcommand{\nbc}[1]{[#1]\ } 15 | \newcommand{\addednb}[2]{\added{\nbc{#1}#2}} 16 | \newcommand{\removednb}[2]{\removed{\nbc{#1}#2}} 17 | \newcommand{\changednb}[3]{\removednb{#1}{#2}\added{#3}} 18 | \newcommand{\remitem}[1]{\item\removed{#1}} 19 | 20 | \newcommand{\ednote}[1]{\textcolor{noteclr}{[Editor's note: #1] }} 21 | % \newcommand{\ednote}[1]{} 22 | 23 | \newenvironment{addedblock} 24 | { 25 | \color{addclr} 26 | } 27 | { 28 | \color{black} 29 | } 30 | \newenvironment{removedblock} 31 | { 32 | \color{remclr} 33 | } 34 | { 35 | \color{black} 36 | } 37 | 38 | %%-------------------------------------------------- 39 | %% Sectioning macros. 40 | % Each section has a depth, an automatically generated section 41 | % number, a name, and a short tag. The depth is an integer in 42 | % the range [0,5]. (If it proves necessary, it wouldn't take much 43 | % programming to raise the limit from 5 to something larger.) 44 | 45 | 46 | % The basic sectioning command. Example: 47 | % \Sec1[intro.scope]{Scope} 48 | % defines a first-level section whose name is "Scope" and whose short 49 | % tag is intro.scope. The square brackets are mandatory. 50 | \def\Sec#1[#2]#3{% 51 | \ifcase#1\let\s=\chapter 52 | \or\let\s=\section 53 | \or\let\s=\subsection 54 | \or\let\s=\subsubsection 55 | \or\let\s=\paragraph 56 | \or\let\s=\subparagraph 57 | \fi% 58 | \s[#3]{#3\hfill[#2]}\label{#2}} 59 | 60 | % A convenience feature (mostly for the convenience of the Project 61 | % Editor, to make it easy to move around large blocks of text): 62 | % the \rSec macro is just like the \Sec macro, except that depths 63 | % relative to a global variable, SectionDepthBase. So, for example, 64 | % if SectionDepthBase is 1, 65 | % \rSec1[temp.arg.type]{Template type arguments} 66 | % is equivalent to 67 | % \Sec2[temp.arg.type]{Template type arguments} 68 | \newcounter{SectionDepthBase} 69 | \newcounter{scratch} 70 | 71 | \def\rSec#1[#2]#3{% 72 | \setcounter{scratch}{#1} 73 | \addtocounter{scratch}{\value{SectionDepthBase}} 74 | \Sec{\arabic{scratch}}[#2]{#3}} 75 | 76 | \newcommand{\synopsis}[1]{\textbf{#1}} 77 | 78 | %%-------------------------------------------------- 79 | % Indexing 80 | 81 | % locations 82 | \newcommand{\indextext}[1]{\index[generalindex]{#1}} 83 | \newcommand{\indexlibrary}[1]{\index[libraryindex]{#1}} 84 | \newcommand{\indexgram}[1]{\index[grammarindex]{#1}} 85 | \newcommand{\indeximpldef}[1]{\index[impldefindex]{#1}} 86 | 87 | \newcommand{\indexdefn}[1]{\indextext{#1}} 88 | \newcommand{\indexgrammar}[1]{\indextext{#1}\indexgram{#1}} 89 | \newcommand{\impldef}[1]{\indeximpldef{#1}implementation-defined} 90 | 91 | % appearance 92 | \newcommand{\idxcode}[1]{#1@\tcode{#1}} 93 | \newcommand{\idxhdr}[1]{#1@\tcode{<#1>}} 94 | \newcommand{\idxgram}[1]{#1@\textit{#1}} 95 | 96 | %%-------------------------------------------------- 97 | % General code style 98 | \newcommand{\CodeStyle}{\ttfamily} 99 | \newcommand{\CodeStylex}[1]{\texttt{#1}} 100 | 101 | % Code and definitions embedded in text. 102 | \newcommand{\tcode}[1]{\CodeStylex{#1}} 103 | \newcommand{\techterm}[1]{\textit{#1}\xspace} 104 | \newcommand{\defnx}[2]{\indexdefn{#2}\textit{#1}\xspace} 105 | \newcommand{\defn}[1]{\defnx{#1}{#1}} 106 | \newcommand{\term}[1]{\textit{#1}\xspace} 107 | \newcommand{\grammarterm}[1]{\textit{#1}\xspace} 108 | \newcommand{\placeholder}[1]{\textit{#1}} 109 | \newcommand{\placeholdernc}[1]{\textit{#1\nocorr}} 110 | 111 | %%-------------------------------------------------- 112 | %% allow line break if needed for justification 113 | \newcommand{\brk}{\discretionary{}{}{}} 114 | % especially for scope qualifier 115 | \newcommand{\colcol}{\brk::\brk} 116 | 117 | %%-------------------------------------------------- 118 | %% Macros for funky text 119 | \newcommand{\Cpp}{\texorpdfstring{C\kern-0.05em\protect\raisebox{.35ex}{\textsmaller[2]{+\kern-0.05em+}}}{C++}\xspace} 120 | \newcommand{\CppIII}{\Cpp 2003\xspace} 121 | \newcommand{\CppXI}{\Cpp 2011\xspace} 122 | \newcommand{\CppXIV}{\Cpp 2014\xspace} 123 | \newcommand{\opt}{{\ensuremath{_\mathit{opt}}}\xspace} 124 | \newcommand{\shl}{<{<}} 125 | \newcommand{\shr}{>{>}} 126 | \newcommand{\dcr}{-{-}} 127 | \newcommand{\exor}{\^{}} 128 | \newcommand{\bigoh}[1]{\ensuremath{\mathscr{O}(#1)}} 129 | 130 | % Make all tildes a little larger to avoid visual similarity with hyphens. 131 | % FIXME: Remove \tilde in favour of \~. 132 | \renewcommand{\tilde}{\textasciitilde} 133 | \renewcommand{\~}{\textasciitilde} 134 | \let\OldTextAsciiTilde\textasciitilde 135 | \renewcommand{\textasciitilde}{\protect\raisebox{-0.17ex}{\larger\OldTextAsciiTilde}} 136 | 137 | %%-------------------------------------------------- 138 | %% States and operators 139 | \newcommand{\state}[2]{\tcode{#1}\ensuremath{_{#2}}} 140 | \newcommand{\bitand}{\ensuremath{\, \mathsf{bitand} \,}} 141 | \newcommand{\bitor}{\ensuremath{\, \mathsf{bitor} \,}} 142 | \newcommand{\xor}{\ensuremath{\, \mathsf{xor} \,}} 143 | \newcommand{\rightshift}{\ensuremath{\, \mathsf{rshift} \,}} 144 | \newcommand{\leftshift}[1]{\ensuremath{\, \mathsf{lshift}_#1 \,}} 145 | 146 | %% Notes and examples 147 | \newcommand{\EnterBlock}[1]{[\,\textit{#1:}\space} 148 | \newcommand{\ExitBlock}[1]{\textit{\,---\,end #1}\,]\xspace} 149 | \newcommand{\enternote}{\EnterBlock{Note}} 150 | \newcommand{\exitnote}{\ExitBlock{note}} 151 | \newcommand{\enterexample}{\EnterBlock{Example}} 152 | \newcommand{\exitexample}{\ExitBlock{example}} 153 | \newenvironment{example}[1][Example]{\EnterBlock{#1}}{\ExitBlock{example}} 154 | 155 | %% Library function descriptions 156 | \newcommand{\Fundescx}[1]{\textit{#1}\xspace} 157 | \newcommand{\Fundesc}[1]{\Fundescx{#1:}} 158 | \newcommand{\required}{\Fundesc{Required behavior}} 159 | \newcommand{\requires}{\Fundesc{Requires}} 160 | \newcommand{\effects}{\Fundesc{Effects}} 161 | \newcommand{\postconditions}{\Fundesc{Postconditions}} 162 | \newcommand{\postcondition}{\Fundesc{Postcondition}} 163 | \newcommand{\preconditions}{\requires} 164 | \newcommand{\precondition}{\requires} 165 | \newcommand{\returns}{\Fundesc{Returns}} 166 | \newcommand{\throws}{\Fundesc{Throws}} 167 | \newcommand{\default}{\Fundesc{Default behavior}} 168 | \newcommand{\complexity}{\Fundesc{Complexity}} 169 | \newcommand{\remark}{\Fundesc{Remark}} 170 | \newcommand{\remarks}{\Fundesc{Remarks}} 171 | \newcommand{\note}{\remark} 172 | \newcommand{\notes}{\remarks} 173 | \newcommand{\realnote}{\Fundesc{Note}} 174 | \newcommand{\realnotes}{\Fundesc{Notes}} 175 | \newcommand{\errors}{\Fundesc{Error conditions}} 176 | \newcommand{\sync}{\Fundesc{Synchronization}} 177 | \newcommand{\implimits}{\Fundesc{Implementation limits}} 178 | \newcommand{\replaceable}{\Fundesc{Replaceable}} 179 | \newcommand{\returntype}{\Fundesc{Return type}} 180 | \newcommand{\cvalue}{\Fundesc{Value}} 181 | \newcommand{\ctype}{\Fundesc{Type}} 182 | \newcommand{\ctypes}{\Fundesc{Types}} 183 | \newcommand{\dtype}{\Fundesc{Default type}} 184 | \newcommand{\ctemplate}{\Fundesc{Class template}} 185 | \newcommand{\templalias}{\Fundesc{Alias template}} 186 | 187 | %% Cross reference 188 | \newcommand{\xref}{\textsc{See also:}\xspace} 189 | \newcommand{\xsee}{\textsc{See:}\xspace} 190 | 191 | %% NTBS, etc. 192 | \newcommand{\NTS}[1]{\textsc{#1}\xspace} 193 | \newcommand{\ntbs}{\NTS{ntbs}} 194 | \newcommand{\ntmbs}{\NTS{ntmbs}} 195 | \newcommand{\ntwcs}{\NTS{ntwcs}} 196 | \newcommand{\ntcxvis}{\NTS{ntc16s}} 197 | \newcommand{\ntcxxxiis}{\NTS{ntc32s}} 198 | 199 | %% Code annotations 200 | \newcommand{\EXPO}[1]{\textit{#1}} 201 | \newcommand{\expos}{\EXPO{exposition only}} 202 | \newcommand{\impdef}{\EXPO{implementation-defined}} 203 | \newcommand{\impdefnc}{\EXPO{implementation-defined\nocorr}} 204 | \newcommand{\impdefx}[1]{\indeximpldef{#1}\EXPO{implementation-defined}} 205 | \newcommand{\notdef}{\EXPO{not defined}} 206 | 207 | \newcommand{\UNSP}[1]{\textit{\texttt{#1}}} 208 | \newcommand{\UNSPnc}[1]{\textit{\texttt{#1}\nocorr}} 209 | \newcommand{\unspec}{\UNSP{unspecified}} 210 | \newcommand{\unspecnc}{\UNSPnc{unspecified}} 211 | \newcommand{\unspecbool}{\UNSP{unspecified-bool-type}} 212 | \newcommand{\seebelow}{\UNSP{see below}} 213 | \newcommand{\seebelownc}{\UNSPnc{see below}} 214 | \newcommand{\unspecuniqtype}{\UNSP{unspecified unique type}} 215 | \newcommand{\unspecalloctype}{\UNSP{unspecified allocator type}} 216 | 217 | \newcommand{\EXPLICIT}{\textit{\texttt{EXPLICIT}}} 218 | 219 | %% Manual insertion of italic corrections, for aligning in the presence 220 | %% of the above annotations. 221 | \newlength{\itcorrwidth} 222 | \newlength{\itletterwidth} 223 | \newcommand{\itcorr}[1][]{% 224 | \settowidth{\itcorrwidth}{\textit{x\/}}% 225 | \settowidth{\itletterwidth}{\textit{x\nocorr}}% 226 | \addtolength{\itcorrwidth}{-1\itletterwidth}% 227 | \makebox[#1\itcorrwidth]{}% 228 | } 229 | 230 | %% Double underscore 231 | \newcommand{\ungap}{\kern.5pt} 232 | \newcommand{\unun}{\_\ungap\_} 233 | \newcommand{\xname}[1]{\unun\ungap#1} 234 | \newcommand{\mname}[1]{\tcode{\unun\ungap#1\ungap\unun}} 235 | 236 | %% Ranges 237 | \newcommand{\Range}[4]{\tcode{#1#3,~\brk{}#4#2}\xspace} 238 | \newcommand{\crange}[2]{\Range{[}{]}{#1}{#2}} 239 | \newcommand{\brange}[2]{\Range{(}{]}{#1}{#2}} 240 | \newcommand{\orange}[2]{\Range{(}{)}{#1}{#2}} 241 | \newcommand{\range}[2]{\Range{[}{)}{#1}{#2}} 242 | 243 | %% Change descriptions 244 | \newcommand{\diffdef}[1]{\hfill\break\textbf{#1:}\xspace} 245 | \newcommand{\change}{\diffdef{Change}} 246 | \newcommand{\rationale}{\diffdef{Rationale}} 247 | \newcommand{\effect}{\diffdef{Effect on original feature}} 248 | \newcommand{\difficulty}{\diffdef{Difficulty of converting}} 249 | \newcommand{\howwide}{\diffdef{How widely used}} 250 | 251 | %% Miscellaneous 252 | \newcommand{\uniquens}{\textrm{\textit{\textbf{unique}}}} 253 | \newcommand{\stage}[1]{\item{\textbf{Stage #1:}}\xspace} 254 | \newcommand{\doccite}[1]{\textit{#1}\xspace} 255 | \newcommand{\cvqual}[1]{\textit{#1}} 256 | \newcommand{\cv}{\cvqual{cv}} 257 | \renewcommand{\emph}[1]{\textit{#1}\xspace} 258 | \newcommand{\numconst}[1]{\textsl{#1}\xspace} 259 | \newcommand{\logop}[1]{{\footnotesize #1}\xspace} 260 | 261 | %%-------------------------------------------------- 262 | %% Environments for code listings. 263 | 264 | % We use the 'listings' package, with some small customizations. The 265 | % most interesting customization: all TeX commands are available 266 | % within comments. Comments are set in italics, keywords and strings 267 | % don't get special treatment. 268 | 269 | \lstset{language=C++, 270 | basicstyle=\small\CodeStyle, 271 | keywordstyle=, 272 | stringstyle=, 273 | xleftmargin=1em, 274 | showstringspaces=false, 275 | commentstyle=\itshape\rmfamily, 276 | columns=flexible, 277 | keepspaces=true, 278 | texcl=true} 279 | 280 | % Our usual abbreviation for 'listings'. Comments are in 281 | % italics. Arbitrary TeX commands can be used if they're 282 | % surrounded by @ signs. 283 | \newcommand{\CodeBlockSetup}{ 284 | \lstset{escapechar=@} 285 | \renewcommand{\tcode}[1]{\textup{\CodeStylex{##1}}} 286 | \renewcommand{\techterm}[1]{\textit{\CodeStylex{##1}}} 287 | \renewcommand{\term}[1]{\textit{##1}} 288 | \renewcommand{\grammarterm}[1]{\textit{##1}} 289 | } 290 | 291 | \lstnewenvironment{codeblock}{\CodeBlockSetup}{} 292 | \lstnewenvironment{Program}{}{} 293 | 294 | % A code block in which single-quotes are digit separators 295 | % rather than character literals. 296 | \lstnewenvironment{codeblockdigitsep}{ 297 | \CodeBlockSetup 298 | \lstset{deletestring=[b]{'}} 299 | }{} 300 | 301 | % Permit use of '@' inside codeblock blocks (don't ask) 302 | \makeatletter 303 | \newcommand{\atsign}{@} 304 | \makeatother 305 | 306 | %%-------------------------------------------------- 307 | %% Indented text 308 | \newenvironment{indented} 309 | {\list{}{}\item\relax} 310 | {\endlist} 311 | 312 | %%-------------------------------------------------- 313 | %% Library item descriptions 314 | \lstnewenvironment{itemdecl} 315 | { 316 | \lstset{escapechar=@, 317 | xleftmargin=0em, 318 | aboveskip=2ex, 319 | belowskip=0ex % leave this alone: it keeps these things out of the 320 | % footnote area 321 | } 322 | } 323 | { 324 | } 325 | 326 | \newenvironment{itemdescr} 327 | { 328 | \begin{indented}} 329 | { 330 | \end{indented} 331 | } 332 | 333 | 334 | %%-------------------------------------------------- 335 | %% Bnf environments 336 | \newlength{\BnfIndent} 337 | \setlength{\BnfIndent}{\leftmargini} 338 | \newlength{\BnfInc} 339 | \setlength{\BnfInc}{\BnfIndent} 340 | \newlength{\BnfRest} 341 | \setlength{\BnfRest}{2\BnfIndent} 342 | \newcommand{\BnfNontermshape}{\small\rmfamily\itshape} 343 | \newcommand{\BnfTermshape}{\small\ttfamily\upshape} 344 | \newcommand{\nonterminal}[1]{{\BnfNontermshape #1}} 345 | 346 | \newenvironment{bnfbase} 347 | { 348 | \newcommand{\nontermdef}[1]{\nonterminal{##1}\indexgrammar{\idxgram{##1}}:} 349 | \newcommand{\terminal}[1]{{\BnfTermshape ##1}\xspace} 350 | \newcommand{\descr}[1]{\normalfont{##1}} 351 | \newcommand{\bnfindentfirst}{\BnfIndent} 352 | \newcommand{\bnfindentinc}{\BnfInc} 353 | \newcommand{\bnfindentrest}{\BnfRest} 354 | \begin{minipage}{.9\hsize} 355 | \newcommand{\br}{\hfill\\} 356 | \frenchspacing 357 | } 358 | { 359 | \nonfrenchspacing 360 | \end{minipage} 361 | } 362 | 363 | \newenvironment{BnfTabBase}[1] 364 | { 365 | \begin{bnfbase} 366 | #1 367 | \begin{indented} 368 | \begin{tabbing} 369 | \hspace*{\bnfindentfirst}\=\hspace{\bnfindentinc}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\hspace{.6in}\=\kill} 370 | { 371 | \end{tabbing} 372 | \end{indented} 373 | \end{bnfbase} 374 | } 375 | 376 | \newenvironment{bnfkeywordtab} 377 | { 378 | \begin{BnfTabBase}{\BnfTermshape} 379 | } 380 | { 381 | \end{BnfTabBase} 382 | } 383 | 384 | \newenvironment{bnftab} 385 | { 386 | \begin{BnfTabBase}{\BnfNontermshape} 387 | } 388 | { 389 | \end{BnfTabBase} 390 | } 391 | 392 | \newenvironment{simplebnf} 393 | { 394 | \begin{bnfbase} 395 | \BnfNontermshape 396 | \begin{indented} 397 | } 398 | { 399 | \end{indented} 400 | \end{bnfbase} 401 | } 402 | 403 | \newenvironment{bnf} 404 | { 405 | \begin{bnfbase} 406 | \list{} 407 | { 408 | \setlength{\leftmargin}{\bnfindentrest} 409 | \setlength{\listparindent}{-\bnfindentinc} 410 | \setlength{\itemindent}{\listparindent} 411 | } 412 | \BnfNontermshape 413 | \item\relax 414 | } 415 | { 416 | \endlist 417 | \end{bnfbase} 418 | } 419 | 420 | % non-copied versions of bnf environments 421 | \newenvironment{ncbnftab} 422 | { 423 | \begin{bnftab} 424 | } 425 | { 426 | \end{bnftab} 427 | } 428 | 429 | \newenvironment{ncsimplebnf} 430 | { 431 | \begin{simplebnf} 432 | } 433 | { 434 | \end{simplebnf} 435 | } 436 | 437 | \newenvironment{ncbnf} 438 | { 439 | \begin{bnf} 440 | } 441 | { 442 | \end{bnf} 443 | } 444 | 445 | %%-------------------------------------------------- 446 | %% Drawing environment 447 | % 448 | % usage: \begin{drawing}{UNITLENGTH}{WIDTH}{HEIGHT}{CAPTION} 449 | \newenvironment{drawing}[4] 450 | { 451 | \newcommand{\mycaption}{#4} 452 | \begin{figure}[h] 453 | \setlength{\unitlength}{#1} 454 | \begin{center} 455 | \begin{picture}(#2,#3)\thicklines 456 | } 457 | { 458 | \end{picture} 459 | \end{center} 460 | \caption{\mycaption} 461 | \end{figure} 462 | } 463 | 464 | %%-------------------------------------------------- 465 | %% Environment for imported graphics 466 | % usage: \begin{importgraphic}{CAPTION}{TAG}{FILE} 467 | 468 | \newenvironment{importgraphic}[3] 469 | {% 470 | \newcommand{\cptn}{#1} 471 | \newcommand{\lbl}{#2} 472 | \begin{figure}[htp]\centering% 473 | \includegraphics[scale=.35]{#3} 474 | } 475 | { 476 | \caption{\cptn}\label{\lbl}% 477 | \end{figure}} 478 | 479 | %% enumeration display overrides 480 | % enumerate with lowercase letters 481 | \newenvironment{enumeratea} 482 | { 483 | \renewcommand{\labelenumi}{\alph{enumi})} 484 | \begin{enumerate} 485 | } 486 | { 487 | \end{enumerate} 488 | } 489 | 490 | % enumerate with arabic numbers 491 | \newenvironment{enumeraten} 492 | { 493 | \renewcommand{\labelenumi}{\arabic{enumi})} 494 | \begin{enumerate} 495 | } 496 | { 497 | \end{enumerate} 498 | } 499 | 500 | %%-------------------------------------------------- 501 | %% Definitions section 502 | % usage: \definition{name}{xref} 503 | %\newcommand{\definition}[2]{\rSec2[#2]{#1}} 504 | % for ISO format, use: 505 | \newcommand{\definition}[2]{% 506 | \subsection[#1]{\hfill[#2]}\vspace{-.3\onelineskip}\label{#2}\textbf{#1}\\% 507 | } 508 | \newcommand{\definitionx}[2]{% 509 | \subsubsection[#1]{\hfill[#2]}\vspace{-.3\onelineskip}\label{#2}\textbf{#1}\\% 510 | } 511 | \newcommand{\defncontext}[1]{\textlangle#1\textrangle} 512 | -------------------------------------------------------------------------------- /src/overloading.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | 3 | \setcounter{chapter}{15} 4 | \rSec0[over]{Overloading} 5 | 6 | \setcounter{section}{4} 7 | \rSec1[over.oper]{Overloaded operators} 8 | 9 | \setcounter{subsection}{7} 10 | \rSec2[over.literal]{User-defined literals} 11 | 12 | \noindent 13 | Modify paragraph 16.5.8/7 as follows: 14 | \begin{std.txt} 15 | \resetalinea[6] 16 | \alinea 17 | \enternote 18 | Literal operators and literal operator templates are usually invoked 19 | implicitly through user-defined literals (5.13.8). However, except for 20 | the constraints described above, they are ordinary namespace-scope 21 | functions and function templates. In particular, they are looked up 22 | like ordinary functions and function templates and they follow the same 23 | overload resolution rules. Also, they can be declared \tcode{inline} 24 | or \tcode{constexpr}, 25 | they can have internal\added{, module,} or external linkage, they can be called explicitly, 26 | their addresses can be taken, etc. 27 | \exitnote 28 | \end{std.txt} 29 | -------------------------------------------------------------------------------- /src/references.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | 3 | \rSec0[intro.refs]{Normative references} 4 | 5 | \pnum 6 | 7 | The following documents are referred to in the text in such a way 8 | that some or all of their content constitutes requirements of this 9 | document. For dated references, only the edition cited applies. 10 | For undated references, the latest edition 11 | of the referenced document (including any amendments) applies. 12 | 13 | \begin{itemize} 14 | \item ISO/IEC 14882:2017, \doccite{Programming Languages -- \Cpp} 15 | \end{itemize} 16 | 17 | ISO/IEC 14882:2017 is hereafter called the \defn{\Cpp Standard}. 18 | % 19 | The numbering of clauses, subclauses, and paragraphs in this document 20 | reflects the numbering in the \Cpp Standard. References to clauses 21 | and subclauses not appearing in this document refer to 22 | the original, unmodified text in the \Cpp Standard. 23 | 24 | -------------------------------------------------------------------------------- /src/scope.tex: -------------------------------------------------------------------------------- 1 | 2 | \rSec0[intro.scope]{Scope} 3 | 4 | \pnum 5 | This document describes extensions to the \Cpp 6 | Programming Language (Clause \ref{intro.refs}) that introduce modules, 7 | a functionality for designating a set of translation units by symbolic 8 | name and ability to express symbolic dependency on modules, and to 9 | define interfaces of modules. These extensions include 10 | new syntactic forms and modifications to existing language semantics. 11 | 12 | \pnum 13 | ISO/IEC 14882 provides important context 14 | and specification for this document. This document is 15 | written as a set of changes against that specification. Instructions 16 | to modify or add paragraphs are written as explicit instructions. 17 | Modifications made directly to existing text from ISO/IEC 14882 use \added{underlining} to represent added text and 18 | \removed{strikethrough} to represent deleted text. 19 | 20 | -------------------------------------------------------------------------------- /src/styles.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | %% styles.tex -- set styles for: 3 | % chapters 4 | % pages 5 | % footnotes 6 | 7 | %%-------------------------------------------------- 8 | %% create chapter style 9 | 10 | \makechapterstyle{cppstd}{% 11 | \renewcommand{\beforechapskip}{\onelineskip} 12 | \renewcommand{\afterchapskip}{\onelineskip} 13 | \renewcommand{\chapternamenum}{} 14 | \renewcommand{\chapnamefont}{\chaptitlefont} 15 | \renewcommand{\chapnumfont}{\chaptitlefont} 16 | \renewcommand{\printchapternum}{\chapnumfont\thechapter\quad} 17 | \renewcommand{\afterchapternum}{} 18 | } 19 | 20 | %%-------------------------------------------------- 21 | %% create page styles 22 | 23 | \makepagestyle{cpppage} 24 | \makeevenhead{cpppage}{}{}{\textbf{\docno}} 25 | \makeoddhead{cpppage}{}{}{\textbf{\docno}} 26 | \makeevenfoot{cpppage}{\leftmark}{}{\thepage} 27 | \makeoddfoot{cpppage}{\leftmark}{}{\thepage} 28 | 29 | \makeatletter 30 | \makepsmarks{cpppage}{% 31 | \let\@mkboth\markboth 32 | \def\chaptermark##1{\markboth{##1}{##1}}% 33 | \def\sectionmark##1{\markboth{% 34 | \ifnum \c@secnumdepth>\z@ 35 | \textsection\space\thesection 36 | \fi 37 | }{\rightmark}}% 38 | \def\subsectionmark##1{\markboth{% 39 | \ifnum \c@secnumdepth>\z@ 40 | \textsection\space\thesubsection 41 | \fi 42 | }{\rightmark}}% 43 | \def\subsubsectionmark##1{\markboth{% 44 | \ifnum \c@secnumdepth>\z@ 45 | \textsection\space\thesubsubsection 46 | \fi 47 | }{\rightmark}}% 48 | \def\paragraphmark##1{\markboth{% 49 | \ifnum \c@secnumdepth>\z@ 50 | \textsection\space\theparagraph 51 | \fi 52 | }{\rightmark}}} 53 | \makeatother 54 | 55 | \aliaspagestyle{chapter}{cpppage} 56 | 57 | %%-------------------------------------------------- 58 | %% set heading styles for main matter 59 | \newcommand{\beforeskip}{-.7\onelineskip plus -1ex} 60 | \newcommand{\afterskip}{.3\onelineskip minus .2ex} 61 | 62 | \setbeforesecskip{\beforeskip} 63 | \setsecindent{0pt} 64 | \setsecheadstyle{\large\bfseries\raggedright} 65 | \setaftersecskip{\afterskip} 66 | 67 | \setbeforesubsecskip{\beforeskip} 68 | \setsubsecindent{0pt} 69 | \setsubsecheadstyle{\large\bfseries\raggedright} 70 | \setaftersubsecskip{\afterskip} 71 | 72 | \setbeforesubsubsecskip{\beforeskip} 73 | \setsubsubsecindent{0pt} 74 | \setsubsubsecheadstyle{\normalsize\bfseries\raggedright} 75 | \setaftersubsubsecskip{\afterskip} 76 | 77 | \setbeforeparaskip{\beforeskip} 78 | \setparaindent{0pt} 79 | \setparaheadstyle{\normalsize\bfseries\raggedright} 80 | \setafterparaskip{\afterskip} 81 | 82 | \setbeforesubparaskip{\beforeskip} 83 | \setsubparaindent{0pt} 84 | \setsubparaheadstyle{\normalsize\bfseries\raggedright} 85 | \setaftersubparaskip{\afterskip} 86 | 87 | %%-------------------------------------------------- 88 | % set heading style for annexes 89 | \newcommand{\Annex}[3]{\chapter[#2]{(#3)\protect\\#2\hfill[#1]}\relax\label{#1}} 90 | \newcommand{\infannex}[2]{\Annex{#1}{#2}{informative}} 91 | \newcommand{\normannex}[2]{\Annex{#1}{#2}{normative}} 92 | 93 | %%-------------------------------------------------- 94 | %% set footnote style 95 | \footmarkstyle{\smaller#1) } 96 | 97 | %%-------------------------------------------------- 98 | % set style for main text 99 | \setlength{\parindent}{0pt} 100 | \setlength{\parskip}{1ex} 101 | \setlength{\partopsep}{-1.5ex} 102 | 103 | %%-------------------------------------------------- 104 | %% set caption style and delimiter 105 | \captionstyle{\centering} 106 | \captiondelim{ --- } 107 | % override longtable's caption delimiter to match 108 | \makeatletter 109 | \def\LT@makecaption#1#2#3{% 110 | \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{% 111 | \sbox\@tempboxa{#1{#2 --- }#3}% 112 | \ifdim\wd\@tempboxa>\hsize 113 | #1{#2 --- }#3% 114 | \else 115 | \hbox to\hsize{\hfil\box\@tempboxa\hfil}% 116 | \fi 117 | \endgraf\vskip\baselineskip}% 118 | \hss}}} 119 | \makeatother 120 | 121 | %%-------------------------------------------------- 122 | %% set global styles that get reset by \mainmatter 123 | \newcommand{\setglobalstyles}{ 124 | \counterwithout{footnote}{chapter} 125 | \counterwithout{table}{chapter} 126 | \counterwithout{figure}{chapter} 127 | \renewcommand{\chaptername}{} 128 | \renewcommand{\appendixname}{Annex } 129 | } 130 | 131 | %%-------------------------------------------------- 132 | %% change list item markers to number and em-dash 133 | 134 | \renewcommand{\labelitemi}{---\parabullnum{Bullets1}{\labelsep}} 135 | \renewcommand{\labelitemii}{---\parabullnum{Bullets2}{\labelsep}} 136 | \renewcommand{\labelitemiii}{---\parabullnum{Bullets3}{\labelsep}} 137 | \renewcommand{\labelitemiv}{---\parabullnum{Bullets4}{\labelsep}} 138 | 139 | %%-------------------------------------------------- 140 | %% set section numbering limit, toc limit 141 | \maxsecnumdepth{subparagraph} 142 | \setcounter{tocdepth}{1} 143 | -------------------------------------------------------------------------------- /src/tables.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = ts.tex 2 | % Definitions of table environments 3 | 4 | %%-------------------------------------------------- 5 | %% Table environments 6 | 7 | % Set parameters for floating tables 8 | \setcounter{totalnumber}{10} 9 | 10 | % Base definitions for tables 11 | \newenvironment{TableBase} 12 | { 13 | \renewcommand{\tcode}[1]{{\CodeStylex{##1}}} 14 | \newcommand{\topline}{\hline} 15 | \newcommand{\capsep}{\hline\hline} 16 | \newcommand{\rowsep}{\hline} 17 | \newcommand{\bottomline}{\hline} 18 | 19 | %% vertical alignment 20 | \newcommand{\rb}[1]{\raisebox{1.5ex}[0pt]{##1}} % move argument up half a row 21 | 22 | %% header helpers 23 | \newcommand{\hdstyle}[1]{\textbf{##1}} % set header style 24 | \newcommand{\Head}[3]{\multicolumn{##1}{##2}{\hdstyle{##3}}} % add title spanning multiple columns 25 | \newcommand{\lhdrx}[2]{\Head{##1}{|c}{##2}} % set header for left column spanning #1 columns 26 | \newcommand{\chdrx}[2]{\Head{##1}{c}{##2}} % set header for center column spanning #1 columns 27 | \newcommand{\rhdrx}[2]{\Head{##1}{c|}{##2}} % set header for right column spanning #1 columns 28 | \newcommand{\ohdrx}[2]{\Head{##1}{|c|}{##2}} % set header for only column spanning #1 columns 29 | \newcommand{\lhdr}[1]{\lhdrx{1}{##1}} % set header for single left column 30 | \newcommand{\chdr}[1]{\chdrx{1}{##1}} % set header for single center column 31 | \newcommand{\rhdr}[1]{\rhdrx{1}{##1}} % set header for single right column 32 | \newcommand{\ohdr}[1]{\ohdrx{1}{##1}} 33 | \newcommand{\br}{\hfill\break} % force newline within table entry 34 | 35 | %% column styles 36 | \newcolumntype{x}[1]{>{\raggedright\let\\=\tabularnewline}p{##1}} % word-wrapped ragged-right 37 | % column, width specified by #1 38 | % \newcolumntype{m}[1]{>{\CodeStyle}l{##1}} % variable width column, all entries in CodeStyle 39 | \newcolumntype{m}[1]{l{##1}} % variable width column, all entries in CodeStyle 40 | 41 | % do not number bullets within tables 42 | \renewcommand{\labelitemi}{---} 43 | \renewcommand{\labelitemii}{---} 44 | \renewcommand{\labelitemiii}{---} 45 | \renewcommand{\labelitemiv}{---} 46 | } 47 | { 48 | } 49 | 50 | % General Usage: TITLE is the title of the table, XREF is the 51 | % cross-reference for the table. LAYOUT is a sequence of column 52 | % type specifiers (e.g. cp{1.0}c), without '|' for the left edge 53 | % or right edge. 54 | 55 | % usage: \begin{floattablebase}{TITLE}{XREF}{COLUMNS}{PLACEMENT} 56 | % produces floating table, location determined within limits 57 | % by LaTeX. 58 | \newenvironment{floattablebase}[4] 59 | { 60 | \begin{TableBase} 61 | \begin{table}[#4] 62 | \caption{\label{#2}#1} 63 | \begin{center} 64 | \begin{tabular}{|#3|} 65 | } 66 | { 67 | \bottomline 68 | \end{tabular} 69 | \end{center} 70 | \end{table} 71 | \end{TableBase} 72 | } 73 | 74 | % usage: \begin{floattable}{TITLE}{XREF}{COLUMNS} 75 | % produces floating table, location determined within limits 76 | % by LaTeX. 77 | \newenvironment{floattable}[3] 78 | { 79 | \begin{floattablebase}{#1}{#2}{#3}{htbp} 80 | } 81 | { 82 | \end{floattablebase} 83 | } 84 | 85 | % usage: \begin{tokentable}{TITLE}{XREF}{HDR1}{HDR2} 86 | % produces six-column table used for lists of replacement tokens; 87 | % the columns are in pairs -- left-hand column has header HDR1, 88 | % right hand column has header HDR2; pairs of columns are separated 89 | % by vertical lines. Used in "trigraph sequences" table in standard. 90 | \newenvironment{tokentable}[4] 91 | { 92 | \begin{floattablebase}{#1}{#2}{cc|cc|cc}{htbp} 93 | \topline 94 | #3 & #4 & 95 | #3 & #4 & 96 | #3 & #4 \\ \capsep 97 | } 98 | { 99 | \end{floattablebase} 100 | } 101 | 102 | % usage: \begin{libsumtabbase}{TITLE}{XREF}{HDR1}{HDR2} 103 | % produces three-column table with column headers HDR1 and HDR2. 104 | % Used in "Library Categories" table in standard, and used as 105 | % base for other library summary tables. 106 | \newenvironment{libsumtabbase}[4] 107 | { 108 | \begin{floattable}{#1}{#2}{lll} 109 | \topline 110 | \lhdrx{2}{#3} & \hdstyle{#4} \\ \capsep 111 | } 112 | { 113 | \end{floattable} 114 | } 115 | 116 | % usage: \begin{libsumtab}{TITLE}{XREF} 117 | % produces three-column table with column headers "Subclause" and "Header(s)". 118 | % Used in "C++ Headers for Freestanding Implementations" table in standard. 119 | \newenvironment{libsumtab}[2] 120 | { 121 | \begin{libsumtabbase}{#1}{#2}{Subclause}{Header(s)} 122 | } 123 | { 124 | \end{libsumtabbase} 125 | } 126 | 127 | % usage: \begin{LibSynTab}{CAPTION}{TITLE}{XREF}{COUNT}{LAYOUT} 128 | % produces table with COUNT columns. Used as base for 129 | % C library description tables 130 | \newcounter{LibSynTabCols} 131 | \newcounter{LibSynTabWd} 132 | \newenvironment{LibSynTabBase}[5] 133 | { 134 | \setcounter{LibSynTabCols}{#4} 135 | \setcounter{LibSynTabWd}{#4} 136 | \addtocounter{LibSynTabWd}{-1} 137 | \newcommand{\centry}[1]{\textbf{##1}:} 138 | \newcommand{\macro}{\centry{Macro}} 139 | \newcommand{\macros}{\centry{Macros}} 140 | \newcommand{\function}{\centry{Function}} 141 | \newcommand{\functions}{\centry{Functions}} 142 | \newcommand{\mfunctions}{\centry{Math Functions}} 143 | \newcommand{\cfunctions}{\centry{Classification/comparison Functions}} 144 | \newcommand{\type}{\centry{Type}} 145 | \newcommand{\types}{\centry{Types}} 146 | \newcommand{\values}{\centry{Values}} 147 | \newcommand{\struct}{\centry{Struct}} 148 | \newcommand{\cspan}[1]{\multicolumn{\value{LibSynTabCols}}{|l|}{##1}} 149 | \begin{floattable}{#1 \tcode{<#2>} synopsis}{#3} 150 | {#5} 151 | \topline 152 | \lhdr{Type} & \rhdrx{\value{LibSynTabWd}}{Name(s)} \\ \capsep 153 | } 154 | { 155 | \end{floattable} 156 | } 157 | 158 | % usage: \begin{LibSynTab}{TITLE}{XREF}{COUNT}{LAYOUT} 159 | % produces table with COUNT columns. Used as base for description tables 160 | % for C library 161 | \newenvironment{LibSynTab}[4] 162 | { 163 | \begin{LibSynTabBase}{Header}{#1}{#2}{#3}{#4} 164 | } 165 | { 166 | \end{LibSynTabBase} 167 | } 168 | 169 | % usage: \begin{LibSynTabAdd}{TITLE}{XREF}{COUNT}{LAYOUT} 170 | % produces table with COUNT columns. Used as base for description tables 171 | % for additions to C library 172 | \newenvironment{LibSynTabAdd}[4] 173 | { 174 | \begin{LibSynTabBase}{Additions to header}{#1}{#2}{#3}{#4} 175 | } 176 | { 177 | \end{LibSynTabBase} 178 | } 179 | 180 | % usage: \begin{libsyntabN}{TITLE}{XREF} 181 | % \begin{libsyntabaddN}{TITLE}{XREF} 182 | % produces a table with N columns for C library description tables 183 | \newenvironment{libsyntab2}[2] 184 | { 185 | \begin{LibSynTab}{#1}{#2}{2}{ll} 186 | } 187 | { 188 | \end{LibSynTab} 189 | } 190 | 191 | \newenvironment{libsyntab3}[2] 192 | { 193 | \begin{LibSynTab}{#1}{#2}{3}{lll} 194 | } 195 | { 196 | \end{LibSynTab} 197 | } 198 | 199 | \newenvironment{libsyntab4}[2] 200 | { 201 | \begin{LibSynTab}{#1}{#2}{4}{llll} 202 | } 203 | { 204 | \end{LibSynTab} 205 | } 206 | 207 | \newenvironment{libsyntab5}[2] 208 | { 209 | \begin{LibSynTab}{#1}{#2}{5}{lllll} 210 | } 211 | { 212 | \end{LibSynTab} 213 | } 214 | 215 | \newenvironment{libsyntab6}[2] 216 | { 217 | \begin{LibSynTab}{#1}{#2}{6}{llllll} 218 | } 219 | { 220 | \end{LibSynTab} 221 | } 222 | 223 | \newenvironment{libsyntabadd2}[2] 224 | { 225 | \begin{LibSynTabAdd}{#1}{#2}{2}{ll} 226 | } 227 | { 228 | \end{LibSynTabAdd} 229 | } 230 | 231 | \newenvironment{libsyntabadd3}[2] 232 | { 233 | \begin{LibSynTabAdd}{#1}{#2}{3}{lll} 234 | } 235 | { 236 | \end{LibSynTabAdd} 237 | } 238 | 239 | \newenvironment{libsyntabadd4}[2] 240 | { 241 | \begin{LibSynTabAdd}{#1}{#2}{4}{llll} 242 | } 243 | { 244 | \end{LibSynTabAdd} 245 | } 246 | 247 | \newenvironment{libsyntabadd5}[2] 248 | { 249 | \begin{LibSynTabAdd}{#1}{#2}{5}{lllll} 250 | } 251 | { 252 | \end{LibSynTabAdd} 253 | } 254 | 255 | \newenvironment{libsyntabadd6}[2] 256 | { 257 | \begin{LibSynTabAdd}{#1}{#2}{6}{llllll} 258 | } 259 | { 260 | \end{LibSynTabAdd} 261 | } 262 | 263 | % usage: \begin{libsyntabfN}{TITLE}{XREF} 264 | % produces a fixed width table with N columns for C library description tables 265 | \newenvironment{libsyntabf2}[2] 266 | { 267 | \begin{LibSynTab}{#1}{#2}{2}{p{1in}p{4in}} 268 | } 269 | { 270 | \end{LibSynTab} 271 | } 272 | 273 | \newenvironment{libsyntabf3}[2] 274 | { 275 | \begin{LibSynTab}{#1}{#2}{3}{p{1in}p{.9in}p{2.9in}} 276 | } 277 | { 278 | \end{LibSynTab} 279 | } 280 | 281 | \newenvironment{libsyntabf5}[2] 282 | { 283 | \begin{LibSynTab}{#1}{#2}{5}{p{.9in}p{.9in}p{.9in}p{.9in}p{.9in}} 284 | } 285 | { 286 | \end{LibSynTab} 287 | } 288 | 289 | \newenvironment{libsyntabf4}[2] 290 | { 291 | \begin{LibSynTab}{#1}{#2}{4}{p{1in}p{.9in}p{.9in}p{1.8in}} 292 | } 293 | { 294 | \end{LibSynTab} 295 | } 296 | 297 | % usage: \begin{concepttable}{TITLE}{TAG}{LAYOUT} 298 | % produces table at current location 299 | \newenvironment{concepttable}[3] 300 | { 301 | \begin{TableBase} 302 | \begin{table}[!htb] 303 | \caption[#1]{\label{tab:#2}\label{#2}#1 \textbf{[#2]}} 304 | \begin{center} 305 | \begin{tabular}{|#3|} 306 | } 307 | { 308 | \bottomline 309 | \end{tabular} 310 | \end{center} 311 | \end{table} 312 | \end{TableBase} 313 | } 314 | 315 | % usage: \begin{simpletypetable}{TITLE}{TAG}{LAYOUT} 316 | % produces table at current location 317 | \newenvironment{simpletypetable}[3] 318 | { 319 | \begin{TableBase} 320 | \begin{table}[!htb] 321 | \caption{#1}\label{#2} 322 | \begin{center} 323 | \begin{tabular}{|#3|} 324 | } 325 | { 326 | \bottomline 327 | \end{tabular} 328 | \end{center} 329 | \end{table} 330 | \end{TableBase} 331 | } 332 | 333 | % usage: \begin{LongTable}{TITLE}{XREF}{LAYOUT} 334 | % produces table that handles page breaks sensibly. 335 | \newenvironment{LongTable}[3] 336 | { 337 | \newcommand{\continuedcaption}{\caption[]{#1 (continued)}} 338 | \begin{TableBase} 339 | \begin{longtable} 340 | {|#3|}\caption{#1}\label{#2} 341 | } 342 | { 343 | \bottomline 344 | \end{longtable} 345 | \end{TableBase} 346 | } 347 | 348 | % usage: \begin{twocol}{TITLE}{XREF} 349 | % produces a two-column breakable table. Used in 350 | % "simple-type-specifiers and the types they specify" in the standard. 351 | \newenvironment{twocol}[2] 352 | { 353 | \begin{concepttable} 354 | {#1}{#2} 355 | {ll} 356 | } 357 | { 358 | \end{LongTable} 359 | } 360 | 361 | % usage: \begin{libreqtabN}{TITLE}{XREF} 362 | % produces an N-column breakable table. Used in 363 | % most of the library Clauses for requirements tables. 364 | % Example at "Position type requirements" in the standard. 365 | 366 | \newenvironment{libreqtab1}[2] 367 | { 368 | \begin{LongTable} 369 | {#1}{#2} 370 | {x{.55\hsize}} 371 | } 372 | { 373 | \end{LongTable} 374 | } 375 | 376 | \newenvironment{libreqtab2}[2] 377 | { 378 | \begin{LongTable} 379 | {#1}{#2} 380 | {lx{.55\hsize}} 381 | } 382 | { 383 | \end{LongTable} 384 | } 385 | 386 | \newenvironment{libreqtab2a}[2] 387 | { 388 | \begin{LongTable} 389 | {#1}{#2} 390 | {x{.30\hsize}x{.68\hsize}} 391 | } 392 | { 393 | \end{LongTable} 394 | } 395 | 396 | \newenvironment{libreqtab3}[2] 397 | { 398 | \begin{LongTable} 399 | {#1}{#2} 400 | {x{.28\hsize}x{.18\hsize}x{.43\hsize}} 401 | } 402 | { 403 | \end{LongTable} 404 | } 405 | 406 | \newenvironment{libreqtab3a}[2] 407 | { 408 | \begin{LongTable} 409 | {#1}{#2} 410 | {x{.28\hsize}x{.33\hsize}x{.29\hsize}} 411 | } 412 | { 413 | \end{LongTable} 414 | } 415 | 416 | \newenvironment{libreqtab3b}[2] 417 | { 418 | \begin{LongTable} 419 | {#1}{#2} 420 | {x{.40\hsize}x{.25\hsize}x{.25\hsize}} 421 | } 422 | { 423 | \end{LongTable} 424 | } 425 | 426 | \newenvironment{libreqtab3c}[2] 427 | { 428 | \begin{LongTable} 429 | {#1}{#2} 430 | {x{.30\hsize}x{.25\hsize}x{.35\hsize}} 431 | } 432 | { 433 | \end{LongTable} 434 | } 435 | 436 | \newenvironment{libreqtab3d}[2] 437 | { 438 | \begin{LongTable} 439 | {#1}{#2} 440 | {x{.32\hsize}x{.27\hsize}x{.36\hsize}} 441 | } 442 | { 443 | \end{LongTable} 444 | } 445 | 446 | \newenvironment{libreqtab3e}[2] 447 | { 448 | \begin{LongTable} 449 | {#1}{#2} 450 | {x{.38\hsize}x{.27\hsize}x{.25\hsize}} 451 | } 452 | { 453 | \end{LongTable} 454 | } 455 | 456 | \newenvironment{libreqtab3f}[2] 457 | { 458 | \begin{LongTable} 459 | {#1}{#2} 460 | {x{.40\hsize}x{.22\hsize}x{.31\hsize}} 461 | } 462 | { 463 | \end{LongTable} 464 | } 465 | 466 | \newenvironment{libreqtab4}[2] 467 | { 468 | \begin{LongTable} 469 | {#1}{#2} 470 | {x{.14\hsize}x{.30\hsize}x{.30\hsize}x{.14\hsize}} 471 | } 472 | { 473 | \end{LongTable} 474 | } 475 | 476 | \newenvironment{libreqtab4a}[2] 477 | { 478 | \begin{LongTable} 479 | {#1}{#2} 480 | {x{.14\hsize}x{.30\hsize}x{.30\hsize}x{.14\hsize}} 481 | } 482 | { 483 | \end{LongTable} 484 | } 485 | 486 | \newenvironment{libreqtab4b}[2] 487 | { 488 | \begin{LongTable} 489 | {#1}{#2} 490 | {x{.13\hsize}x{.15\hsize}x{.29\hsize}x{.27\hsize}} 491 | } 492 | { 493 | \end{LongTable} 494 | } 495 | 496 | \newenvironment{libreqtab4c}[2] 497 | { 498 | \begin{LongTable} 499 | {#1}{#2} 500 | {x{.16\hsize}x{.21\hsize}x{.21\hsize}x{.30\hsize}} 501 | } 502 | { 503 | \end{LongTable} 504 | } 505 | 506 | \newenvironment{libreqtab4d}[2] 507 | { 508 | \begin{LongTable} 509 | {#1}{#2} 510 | {x{.22\hsize}x{.22\hsize}x{.30\hsize}x{.15\hsize}} 511 | } 512 | { 513 | \end{LongTable} 514 | } 515 | 516 | \newenvironment{libreqtab5}[2] 517 | { 518 | \begin{LongTable} 519 | {#1}{#2} 520 | {x{.14\hsize}x{.14\hsize}x{.20\hsize}x{.20\hsize}x{.14\hsize}} 521 | } 522 | { 523 | \end{LongTable} 524 | } 525 | 526 | % usage: \begin{libtab2}{TITLE}{XREF}{LAYOUT}{HDR1}{HDR2} 527 | % produces two-column table with column headers HDR1 and HDR2. 528 | % Used in "seekoff positioning" in the standard. 529 | \newenvironment{libtab2}[5] 530 | { 531 | \begin{floattable} 532 | {#1}{#2}{#3} 533 | \topline 534 | \lhdr{#4} & \rhdr{#5} \\ \capsep 535 | } 536 | { 537 | \end{floattable} 538 | } 539 | 540 | % usage: \begin{longlibtab2}{TITLE}{XREF}{LAYOUT}{HDR1}{HDR2} 541 | % produces two-column table with column headers HDR1 and HDR2. 542 | \newenvironment{longlibtab2}[5] 543 | { 544 | \begin{LongTable}{#1}{#2}{#3} 545 | \\ \topline 546 | \lhdr{#4} & \rhdr{#5} \\ \capsep 547 | \endfirsthead 548 | \continuedcaption\\ 549 | \topline 550 | \lhdr{#4} & \rhdr{#5} \\ \capsep 551 | \endhead 552 | } 553 | { 554 | \end{LongTable} 555 | } 556 | 557 | % usage: \begin{LibEffTab}{TITLE}{XREF}{HDR2}{WD2} 558 | % produces a two-column table with left column header "Element" 559 | % and right column header HDR2, right column word-wrapped with 560 | % width specified by WD2. 561 | \newenvironment{LibEffTab}[4] 562 | { 563 | \begin{libtab2}{#1}{#2}{lp{#4}}{Element}{#3} 564 | } 565 | { 566 | \end{libtab2} 567 | } 568 | 569 | % Same as LibEffTab except that it uses a long table. 570 | \newenvironment{longLibEffTab}[4] 571 | { 572 | \begin{longlibtab2}{#1}{#2}{lp{#4}}{Element}{#3} 573 | } 574 | { 575 | \end{longlibtab2} 576 | } 577 | 578 | % usage: \begin{libefftab}{TITLE}{XREF} 579 | % produces a two-column effects table with right column 580 | % header "Effect(s) if set", width 4.5 in. Used in "fmtflags effects" 581 | % table in standard. 582 | \newenvironment{libefftab}[2] 583 | { 584 | \begin{LibEffTab}{#1}{#2}{Effect(s) if set}{4.5in} 585 | } 586 | { 587 | \end{LibEffTab} 588 | } 589 | 590 | % Same as libefftab except that it uses a long table. 591 | \newenvironment{longlibefftab}[2] 592 | { 593 | \begin{longLibEffTab}{#1}{#2}{Effect(s) if set}{4.5in} 594 | } 595 | { 596 | \end{longLibEffTab} 597 | } 598 | 599 | % usage: \begin{libefftabmean}{TITLE}{XREF} 600 | % produces a two-column effects table with right column 601 | % header "Meaning", width 4.5 in. Used in "seekdir effects" 602 | % table in standard. 603 | \newenvironment{libefftabmean}[2] 604 | { 605 | \begin{LibEffTab}{#1}{#2}{Meaning}{4.5in} 606 | } 607 | { 608 | \end{LibEffTab} 609 | } 610 | 611 | % Same as libefftabmean except that it uses a long table. 612 | \newenvironment{longlibefftabmean}[2] 613 | { 614 | \begin{longLibEffTab}{#1}{#2}{Meaning}{4.5in} 615 | } 616 | { 617 | \end{longLibEffTab} 618 | } 619 | 620 | % usage: \begin{libefftabvalue}{TITLE}{XREF} 621 | % produces a two-column effects table with right column 622 | % header "Value", width 3 in. Used in "basic_ios::init() effects" 623 | % table in standard. 624 | \newenvironment{libefftabvalue}[2] 625 | { 626 | \begin{LibEffTab}{#1}{#2}{Value}{3in} 627 | } 628 | { 629 | \end{LibEffTab} 630 | } 631 | 632 | % Same as libefftabvalue except that it uses a long table and a 633 | % slightly wider column. 634 | \newenvironment{longlibefftabvalue}[2] 635 | { 636 | \begin{longLibEffTab}{#1}{#2}{Value}{3.5in} 637 | } 638 | { 639 | \end{longLibEffTab} 640 | } 641 | 642 | % usage: \begin{liberrtab}{TITLE}{XREF} produces a two-column table 643 | % with left column header ``Value'' and right header "Error 644 | % condition", width 4.5 in. Used in regex Clause in the TR. 645 | 646 | \newenvironment{liberrtab}[2] 647 | { 648 | \begin{libtab2}{#1}{#2}{lp{4.5in}}{Value}{Error condition} 649 | } 650 | { 651 | \end{libtab2} 652 | } 653 | 654 | % Like liberrtab except that it uses a long table. 655 | \newenvironment{longliberrtab}[2] 656 | { 657 | \begin{longlibtab2}{#1}{#2}{lp{4.5in}}{Value}{Error condition} 658 | } 659 | { 660 | \end{longlibtab2} 661 | } 662 | -------------------------------------------------------------------------------- /src/templates.tex: -------------------------------------------------------------------------------- 1 | %!TEX root = std.tex 2 | \setcounter{chapter}{16} 3 | \rSec0[temp]{Templates}% 4 | %\indextext{template|(} 5 | 6 | \noindent 7 | Modify paragraph 17/2 as follows: 8 | \begin{std.txt} 9 | \resetalinea[1] 10 | \alinea 11 | A \grammarterm{template-declaration} can appear only as a 12 | namespace scope or class scope declaration. 13 | \added{Its \grammarterm{declaration} shall not be an 14 | \grammarterm{export-declaration} or a 15 | \grammarterm{proclaimed-ownership-declaration}.} 16 | In a function template declaration, the last component of the 17 | \grammarterm{declarator-id} shall not be a \grammarterm{template-id}. 18 | \end{std.txt} 19 | 20 | 21 | %gram: \rSec1[gram.temp]{Templates} 22 | %gram: 23 | 24 | %% \setcounter{section}{5} 25 | %% \rSec1[temp.res]{Name resolution} 26 | 27 | %% \setcounter{subsection}{3} 28 | %% \rSec2[temp.dep.res]{Dependent name resolution} 29 | 30 | %% \noindent 31 | %% Modify second bullet of paragraph 14.6.4/1 32 | %% \begin{std.txt} 33 | %% \item[---] Declarations from namespace \added{partitions} associated 34 | %% with the types of the function arguments both from the 35 | %% instantiation context (14.6.4.1) and from the definition context. 36 | %% \end{std.txt} 37 | 38 | \setcounter{section}{5} 39 | \rSec1[temp.res]{Name resolution} 40 | \setcounter{subsection}{3} 41 | \rSec2[temp.dep.res]{Dependent name resolution} 42 | 43 | Add new example to paragraph 17.6.4/1: 44 | \begin{std.txt} 45 | \begin{addedblock} 46 | \enterexample 47 | \begin{codeblock} 48 | // Header file X.h 49 | namespace Q { 50 | struct X { }; 51 | } 52 | 53 | // Interface unit of M1 54 | #include "X.h" // global module 55 | namespace Q { 56 | void g_impl(X, X); 57 | } 58 | export module M1; 59 | export template 60 | void g(T t) { 61 | g_impl(t, Q::X{ }); // \#1: ADL in definition context finds Q::g_impl 62 | } 63 | 64 | // Interface unit of M2 65 | #include "X.h" 66 | import M1; 67 | export module M2; 68 | void h(Q::X x) { 69 | g(x); // OK 70 | } 71 | \end{codeblock} 72 | \exitexample 73 | \end{addedblock} 74 | \end{std.txt} 75 | 76 | 77 | \noindent 78 | Add new paragraphs to 17.6.4: 79 | \begin{std.txt} 80 | \color{addclr} 81 | \resetalinea[1] 82 | \alinea 83 | \enterexample 84 | \begin{codeblock} 85 | // Interface unit of Std 86 | export module Std; 87 | export template 88 | void indirect_swap(Iter lhs, Iter rhs) 89 | { 90 | swap(*lhs, *rhs); // swap can be found only via ADL 91 | } 92 | 93 | // Interface unit of M 94 | import Std; 95 | export module M; 96 | 97 | struct S { /* ...*/ }; 98 | void swap(S&, S&); // \#1; 99 | 100 | void f(S* p, S* q) 101 | { 102 | indirect_swap(p, q); // instantiation finds \#1 via ADL 103 | } 104 | \end{codeblock} 105 | \exitexample 106 | 107 | \alinea 108 | \enterexample 109 | \begin{codeblock} 110 | // Header file X.h 111 | struct X { /* ... */ }; 112 | X operator+(X, X); 113 | 114 | // Module interface unit of F 115 | export module F; 116 | export template 117 | void f(T t) { 118 | t + t; 119 | } 120 | 121 | // Module interface unit of M 122 | #include "X.h" 123 | import F; 124 | export module M; 125 | void g(X x) { 126 | f(x); // OK: instantiates f from F 127 | // point of instantiation: just before g(X) 128 | } 129 | \end{codeblock} 130 | \exitexample 131 | 132 | \alinea 133 | \enternote 134 | \enterexample 135 | \begin{codeblock} 136 | // Module interface unit of A 137 | export module A; 138 | export template 139 | void f(T t) { 140 | t + t; // \#1 141 | } 142 | 143 | // Module interface unit of B 144 | export module B; 145 | import A; 146 | export template 147 | void g(T t, U u) { 148 | f(t); 149 | } 150 | 151 | // Module interface unit of C 152 | #include // not in the purview of C 153 | import B; 154 | export module C; 155 | export template 156 | void h(T t) { 157 | g(std::string{ }, t); 158 | } 159 | 160 | // Translation unit of main() 161 | import C; 162 | void i() { 163 | h(0); // ill-formed: '+' not found at \#1 164 | // point of instantiation of h: just before 'i()' 165 | // point of instantiation of g: same as h's 166 | // point of instantiation of f: same as g's 167 | } 168 | \end{codeblock} 169 | \exitexample 170 | 171 | This example is ill-formed by this document. 172 | It is an open question as to how often the scenario occurs in 173 | practice, and whether to make the example well-formed or whether 174 | additional syntax will be introduced that does not involve 175 | modifying the header. 176 | \exitnote 177 | 178 | \alinea 179 | \enternote 180 | \enterexample 181 | \begin{codeblock} 182 | // Module interface unit of M1 183 | #include 184 | 185 | export module M1; 186 | export template 187 | void f(T& t, U& u) { 188 | min(t, u); // \#1 189 | } 190 | 191 | // Module interface unit of M2 192 | #include 193 | struct Aux : std::ctype_base { 194 | operator int() const; 195 | }; 196 | void min(Aux&, Aux&); // \#2 197 | 198 | export module M2; 199 | import M1; 200 | export template 201 | void g(T t) { 202 | Aux aux; 203 | f(aux, aux); 204 | } 205 | 206 | // Elsewhere, translation unit of global module 207 | import M2; 208 | void h() { 209 | g(0); 210 | } 211 | \end{codeblock} 212 | In the body of the function \tcode{h}, the call to \tcode{g} triggers a request 213 | for (implicit) instantiation of \tcode{g}. The point of instantiation of 214 | that specialization is right before the definition of \tcode{h}. 215 | That instantiation, in turn, requests the implicit instantiation of 216 | \tcode{f}. The point of instantiation of that specialization 217 | immediately preceeds that of \tcode{g}. In that context, the invocation of 218 | \tcode{min}: (a) selects \tcode{std::min}; and (b) invokes the 219 | implicit conversion. In particular, the declaration at {\#2} is not used 220 | because it is neither available in the context of definition, nor in the 221 | context of instantiation of \tcode{f}. 222 | However, paragraph 17.6.4.2/1 of the C++ Standard formally renders the behavior 223 | of the program undefined because the better match wasn't considered. This is 224 | a case where it is unclear if that paragraph is too broad and needs further restrictions, 225 | or if there ought to be a mechanism to consider all such functions. 226 | \exitexample 227 | \exitnote 228 | \end{std.txt} 229 | 230 | 231 | \rSec3[temp.point]{Point of instantiation} 232 | 233 | \noindent 234 | Replace paragraph 17.6.4.1/7 as follows: 235 | \begin{std.txt} 236 | \resetalinea[6] 237 | \alinea 238 | \removed{The instantiation context of an expression that depends on 239 | the template arguments is the set of declarations with external 240 | linkage declared prior to the point of instantiation of the 241 | template specialization in the same translation unit.}\added{The 242 | instantiation context of an expression that depends on template 243 | arguments is the context of a lookup at the point of instantiation 244 | of the enclosing template.} 245 | \end{std.txt} 246 | 247 | 248 | \rSec3[temp.dep.candidate]{Candidate functions} 249 | 250 | \noindent 251 | Modify paragraph 17.6.4.2/1 as follows 252 | \begin{std.txt} 253 | \resetalinea[0] 254 | \alinea 255 | \ldots 256 | 257 | If the call would be ill-formed or would find a better match had the 258 | lookup within the associated namespaces considered all the function 259 | declarations with external \added{or module} 260 | linkage introduced in those namespaces in all 261 | translation units, not just considering those declarations found in the 262 | template definition and template instantiation contexts, then the program 263 | has undefined behavior. 264 | \end{std.txt} 265 | 266 | 267 | 268 | -------------------------------------------------------------------------------- /src/ts.tex: -------------------------------------------------------------------------------- 1 | %% main file for the C++ standard. 2 | %% 3 | 4 | %%-------------------------------------------------- 5 | %% basics 6 | \documentclass[ebook,10pt,oneside,openany,final]{memoir} 7 | 8 | \usepackage[american] 9 | {babel} % needed for iso dates 10 | \usepackage[iso,american] 11 | {isodate} % use iso format for dates 12 | \usepackage[final] 13 | {listings} % code listings 14 | \usepackage{longtable} % auto-breaking tables 15 | \usepackage{ltcaption} % fix captions for long tables 16 | \usepackage{booktabs} % fancy tables 17 | \usepackage{relsize} % provide relative font size changes 18 | \usepackage{underscore} % remove special status of '_' in ordinary text 19 | \usepackage{verbatim} % improved verbatim environment 20 | \usepackage{parskip} % handle non-indented paragraphs "properly" 21 | \usepackage{array} % new column definitions for tables 22 | \usepackage[normalem]{ulem} 23 | \usepackage{color} % define colors for strikeouts and underlines 24 | \usepackage{amsmath} % additional math symbols 25 | \usepackage{mathrsfs} % mathscr font 26 | \usepackage{microtype} 27 | \usepackage{multicol} 28 | \usepackage{xspace} 29 | \usepackage{fixme} 30 | \usepackage{lmodern} 31 | \usepackage[T1]{fontenc} 32 | \usepackage[pdftex, final]{graphicx} 33 | \usepackage[pdftex, 34 | pdftitle={C++ Technical Specification}, 35 | pdfsubject={C++ Technical Specification}, 36 | pdfcreator={Gabriel Dos~Reis}, 37 | bookmarks=true, 38 | bookmarksnumbered=true, 39 | pdfpagelabels=true, 40 | pdfpagemode=UseOutlines, 41 | pdfstartview=FitH, 42 | linktocpage=true, 43 | colorlinks=true, 44 | linkcolor=blue, 45 | plainpages=false 46 | ]{hyperref} 47 | \usepackage{memhfixc} % fix interactions between hyperref and memoir 48 | \usepackage{xstring} 49 | 50 | \input{layout} 51 | \input{styles} 52 | \input{macros} 53 | \input{tables} 54 | 55 | \makeindex[generalindex] 56 | \makeindex[libraryindex] 57 | \makeindex[impldefindex] 58 | 59 | %%-------------------------------------------------- 60 | %% macros specific to the Networking TS 61 | \newcommand{\completionsig}{\Fundesc{Completion signature}} 62 | \newcommand{\DEDUCED}{\textit{\texttt{DEDUCED}}} 63 | \newcommand{\nativeref}{see~\ref{socket.reqmts.native}} 64 | \newcommand{\CppXref}[1]{\texorpdfstring{C\kern-0.05em\protect\raisebox{.35ex}{\textsmaller[2]{+\kern-0.05em+}}Std}{C++Std} [#1]} 65 | % Alternative formatting of cross-references, resolving stable name to number. 66 | % Needs include{cxx} and CppXIV from cplusplus/draft/source/macros.tex. 67 | % \input{cxx} 68 | % \newcommand{\CppXref}[1]{\CppXIV \S\cxxref{#1}} 69 | 70 | % Add two names to the library index as both #1!#2 and #2!#1 71 | \newcommand{\indexlibrarytwo}[2]{% 72 | \indexlibrary{\idxcode{#1}!\idxcode{#2}}% 73 | \indexlibrary{\idxcode{#2}!\idxcode{#1}}% 74 | } 75 | % Add an extensible implementation entry to the main and library name indices 76 | \newcommand{\indexextensible}[1]{% 77 | \indextext{extensible implementation!\idxcode{#1}}% 78 | \indexlibrary{\idxcode{#1}!extensible implementation}% 79 | } 80 | 81 | %%-------------------------------------------------- 82 | %% fix interaction between hyperref and other 83 | %% commands 84 | \pdfstringdefDisableCommands{\def\smaller#1{#1}} 85 | \pdfstringdefDisableCommands{\def\textbf#1{#1}} 86 | \pdfstringdefDisableCommands{\def\raisebox#1{}} 87 | \pdfstringdefDisableCommands{\def\hspace#1{}} 88 | 89 | %%-------------------------------------------------- 90 | %% add special hyphenation rules 91 | \hyphenation{tem-plate ex-am-ple in-put-it-er-a-tor name-space name-spaces} 92 | 93 | %%-------------------------------------------------- 94 | %% turn off all ligatures inside \texttt 95 | \DisableLigatures{encoding = T1, family = tt*} 96 | 97 | % \errorcontextlines 10000 98 | 99 | \begin{document} 100 | \chapterstyle{cppstd} 101 | \pagestyle{cpppage} 102 | 103 | %%-------------------------------------------------- 104 | %% configuration 105 | \input{config} 106 | 107 | %%-------------------------------------------------- 108 | %% front matter 109 | \frontmatter 110 | \include{front} 111 | 112 | %%-------------------------------------------------- 113 | %% main body of the document 114 | \mainmatter 115 | \setglobalstyles 116 | 117 | \include{scope} 118 | \include{references} 119 | \include{definitions} 120 | \include{general} 121 | \include{lexical} 122 | \include{basic} 123 | \include{declarations} 124 | \include{classes} 125 | \include{overloading} 126 | \include{templates} 127 | 128 | 129 | %%-------------------------------------------------- 130 | %% appendices 131 | 132 | %\appendix 133 | %\include{compatibility} 134 | 135 | %%-------------------------------------------------- 136 | %% back matter 137 | %\backmatter 138 | %\include{back} 139 | 140 | 141 | %%-------------------------------------------------- 142 | %% End of document 143 | \end{document} 144 | --------------------------------------------------------------------------------