Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3876,12 +3876,14 @@
or any other names that the library uses to
declare these names. Thus, a \grammarterm{new-expression},
\grammarterm{delete-expression}, or function call that refers to one of
these functions without importing or including the header \libheaderref{new} is
well-formed. However, referring to \tcode{std}
these functions without importing or including the header \libheaderref{new}
or importing a \Cpp{} library module\iref{std.modules}
is well-formed. However, referring to \tcode{std}
or \tcode{std::size_t}
or \tcode{std::align_val_t}
is ill-formed unless the name has been declared
by importing or including the appropriate header.
is ill-formed unless
a standard library declaration\iref{cstddef.syn,new.syn,std.modules}
of that name precedes\iref{basic.lookup.general} the use of that name.
\end{note}
Allocation and/or
deallocation functions may also be declared and defined for any
Expand Down
14 changes: 10 additions & 4 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,10 @@
the deduced type
$\mathtt{T}'$ replacing \tcode{T}
is determined using the rules for template argument deduction.
If the initialization is copy-list-initialization,
a declaration of \tcode{std::initializer_list}
shall precede\iref{basic.lookup.general}
the \grammarterm{placeholder-type-specifier}.
Obtain \tcode{P} from
\tcode{T} by replacing the occurrences of
\opt{\grammarterm{type-constraint}} \keyword{auto} either with
Expand Down Expand Up @@ -5653,10 +5657,12 @@
corresponding parameter to be a non-deduced context\iref{temp.deduct.call}.
\end{note}
The template
\tcode{std::initializer_list} is not predefined; if the header
\tcode{<initializer_list>} is not imported or included prior to a use of
\tcode{std::initializer_list} --- even an implicit use in which the type is not
named\iref{dcl.spec.auto} --- the program is ill-formed.
\tcode{std::initializer_list} is not predefined;
if a standard library declaration\iref{initializer.list.syn,std.modules}
of \tcode{std::initializer_list} is not reachable from\iref{module.reach}
a use of \tcode{std::initializer_list} ---
even an implicit use in which the type is not named\iref{dcl.spec.auto} ---
the program is ill-formed.

\pnum
List-initialization of an object or reference of type \tcode{T} is defined as follows:
Expand Down
12 changes: 7 additions & 5 deletions source/expressions.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3939,9 +3939,10 @@
\end{example}

\pnum
If the header \libheaderref{typeinfo}
is not imported or included prior
to a use of \keyword{typeid}, the program is ill-formed.
The type \tcode{std::type_info}\iref{type.info} is not predefined;
if a standard library declaration\iref{typeinfo.syn,std.modules} of
\tcode{std::type_info} does not precede\iref{basic.lookup.general}
a \tcode{typeid} expression, the program is ill-formed.

\pnum
\begin{note}
Expand Down Expand Up @@ -6429,8 +6430,9 @@
\tcode{std::weak_ordering}, and
\tcode{std::partial_ordering})
are not predefined;
if the header \libheaderref{compare}
is not imported or included prior to a use of such a class type --
if a standard library declaration\iref{compare.syn,std.modules}
of such a class type does not precede\iref{basic.lookup.general}
a use of that type --
even an implicit use in which the type is not named
(e.g., via the \keyword{auto} specifier\iref{dcl.spec.auto}
in a defaulted three-way comparison\iref{class.spaceship}
Expand Down
56 changes: 56 additions & 0 deletions source/lib-intro.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,62 @@
\tcode{wscanf_s} \\
\end{multicolfloattable}

\rSec3[std.modules]{Modules}

\pnum
The \Cpp{} standard library provides
the following \defn{\Cpp{} library modules}.

\pnum
The named module \tcode{std} exports declarations in namespace \tcode{std}
that are provided by the importable \Cpp{} library headers
(\tref{headers.cpp} or the subset provided by a freestanding implementation)
and the \Cpp{} headers for C library facilities~(\tref{headers.cpp.c}).
It additionally exports declarations in the global namespace
for the storage allocation and deallocation functions
that are provided by \libheaderref{new}.

\pnum
The named module \tcode{std.compat} exports the same declarations as
the named module \tcode{std}, and
additionally exports declarations in the global namespace
corresponding to the declarations in namespace \tcode{std}
that are provided by
the \Cpp{} headers for C library facilities~(\tref{headers.cpp.c}).

\pnum
It is unspecified to which module a declaration in the standard library
is attached.
\begin{note}
Implementations are required to ensure that mixing
\tcode{\#include} and \tcode{import} does not result in
conflicting attachments\iref{basic.link}.
\end{note}
\recommended
Implementations should ensure such attachments do not preclude
further evolution or decomposition of the standard library modules.

\pnum
A declaration in the standard library denotes the same entity regardless of
whether it was made reachable through
including a header,
importing a header unit, or
importing a \Cpp{} library module.

\pnum
\recommended
Implementations should avoid exporting any other declarations
from the \Cpp{} library modules.

\begin{note}
Like all named modules, the \Cpp{} library modules
do not make macros visible\iref{module.import}, such as
\tcode{assert}\iref{cassert.syn},
\tcode{errno}\iref{cerrno.syn},
\tcode{offsetof}\iref{cstddef.syn}, and
\tcode{va_arg}\iref{cstdarg.syn}.
\end{note}

\rSec3[compliance]{Freestanding implementations}
\indextext{implementation!freestanding|(}%

Expand Down
1 change: 1 addition & 0 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@
#define @\defnlibxname{cpp_lib_math_special_functions}@ 201603L // also in \libheader{cmath}
#define @\defnlibxname{cpp_lib_mdspan}@ 202207L // also in \libheader{mdspan}
#define @\defnlibxname{cpp_lib_memory_resource}@ 201603L // also in \libheader{memory_resource}
#define @\defnlibxname{cpp_lib_modules}@ 202207L
#define @\defnlibxname{cpp_lib_move_only_function}@ 202110L // also in \libheader{functional}
#define @\defnlibxname{cpp_lib_node_extract}@ 201606L
// also in \libheader{map}, \libheader{set}, \libheader{unordered_map}, \libheader{unordered_set}
Expand Down