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
CWG2870 [lex.string] "" ""
(adjacent ordinary string literals) are ill-formed
#511
Comments
It's been alleged that 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
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
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. |
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. |
"" ""
(adjacent ordinary string literals) are ill-formed"" ""
(adjacent ordinary string literals) are ill-formed
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
"" ""
.The text was updated successfully, but these errors were encountered: