Skip to content

[dcl.init.string] Reword character array initialization #6488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
35 changes: 15 additions & 20 deletions source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -5425,27 +5425,22 @@
\indextext{UTF-8}%
\indextext{UTF-16}%
\indextext{UTF-32}%
An array of ordinary character type\iref{basic.fundamental},
\keyword{char8_t} array,
\keyword{char16_t} array,
\keyword{char32_t} array,
or \keyword{wchar_t} array
may be initialized by
an ordinary string literal,
UTF-8 string literal,
UTF-16 string literal,
UTF-32 string literal, or
wide string literal,
respectively, or by an appropriately-typed \grammarterm{string-literal} enclosed in
braces\iref{lex.string}.
Additionally, an array of \keyword{char} or
\tcode{\keyword{unsigned} \keyword{char}}
may be initialized by
a UTF-8 string literal, or by
such a string literal enclosed in braces.
An object
of type ``array of \tcode{T}''
may be initialized by an optionally brace-enclosed \grammarterm{string-literal}
of type ``array of \tcode{\keyword{const} U}'' if:
\begin{itemize}
\item
\tcode{T} and \tcode{U} are the same type;
\item
\tcode{T} is an ordinary character type\iref{basic.fundamental}, and
\tcode{U} is \keyword{char}; or
\item
\tcode{T} is \keyword{char} or \tcode{\keyword{unsigned} \keyword{char}},
and \tcode{U} is \keyword{char8_t}.
\end{itemize}
\indextext{initialization!character array}%
Successive
characters of the
Successive characters of the
value of the \grammarterm{string-literal}
initialize the elements of the array,
with an integral conversion\iref{conv.integral}
Expand Down