Closed Eisenwave closed 2 months ago
It's been alleged that "" ""
is valid because these string literals have a "none" prefix ([tab:lex.string.literal]), so the aforementioned sentence in paragraph 7 would apply here.
However, the wording specifically mentions encoding-prefix, not "encoding prefix", and the grammar rule never produces the empty word.
Perhaps what we want to say is
~Any other combinations are ill-formed.~ Otherwise, there is no common encoding-prefix and both string-literals shall have no encoding-prefix.
This looks somehow editorial to me...
This looks somehow editorial to me...
You're suggesting to turn "the program is ill-formed" into "the program is well-formed with this behavior ..."; how is that editorial?
This looks somehow editorial to me...
You're suggesting to turn "the program is ill-formed" into "the program is well-formed with this behavior ..."; how is that editorial?
The major issue seems to be that the second sentence may be treated as
If one string-literal has no encoding-prefix and the other has one, the common encoding-prefix is that of the other string-literal.
But my reading is that such treatment isn't or at least shouldn't be valid. The whole precondition should be "one string-literal has no encoding-prefix", so concatenation of adjacent ordinary string literals falls into this case and thus is well-formed.
The issue I see is that it's unclear whether "the common encoding-prefix is that of the other string-literal" can imply that "the common encoding-prefix does not exist if the other string-literal has no encoding-prefix". I believe such implication is intended, but I'm not sure whether it's valid.
I believe such implication is intended, but I'm not sure whether it's valid.
Well, yeah, that's the crux of the issue. I don't believe that such a reading is correct because saying "the encoding-prefix of the other literal" cannot be applied when the other has no encoding-prefix at all.
CWG2870
Reference (section label): [lex.string]
Issue description
Subclause 5.13.5 [lex.string] paragraph 7 states that:
In the case
"" ""
, i.e. when neither string-literal has an encoding-prefix:Therefore, this construct is ill-formed. Arguably, it is not possible to "fill in the blanks" and interpret the latter sentence as:
On another note, it is unusual that we talk about a "common encoding-prefix", even in the case where there is no encoding-prefix at all. The common prefix in this paragraph should not be formatted as a grammar rule.
Suggested resolution
Itemize subclause 5.13.5 [lex.string] paragraph 7, and update the result as follows:
Alternative resolution (not proposed, but worth considering)
In subclause 5.13.5 [lex.string] paragraph 7, replace all occurrences of encoding-prefix with "encoding prefix". This legitimizes applying paragraph 7, sentence 1 or 2 to the case
"" ""
.