cplusplus / draft

C++ standards drafts
http://www.open-std.org/jtc1/sc22/wg21/
5.7k stars 751 forks source link

[lex.string]: Encoding described only for expression evaluation #5090

Open hubert-reinterpretcast opened 3 years ago

hubert-reinterpretcast commented 3 years ago

In [lex.string], the length of the array type of a string literal determined from the number of encoded code units "as described below"; however, the further description only describes encoding for string literal objects, and string literal objects are only mentioned in relation to evaluating a string-literal.

A string may appear within unevaluated operands in such a way that its type needs to be known, for example:

char s[sizeof("Hello, world!")];

As per [expr.context], "[an] unevaluated operand is not evaluated".

Perhaps, "where n is the number of encoded code units as described below in the result of an evaluation of the string-literal were it to be evaluated" would work?

hubert-reinterpretcast commented 3 years ago

@jensmaurer, as discussed Wednesday.