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
[expr.prim.id.dtor] Comment in example reflects lexing misunderstanding #2630
Comments
It seems this is a floating-point literal "0." with a ud-suffix "T" [lex.ext], which happens not to exist. At least that's what gcc tells me, and it seems a reasonable outcome. |
Ah, but if you agree that the |
I stumbled on this when working on syntax highlighting in cxxdraft-htmlgen. If I lex according to the rules, then on the
line, |
In translation phase 3, the "0.T" in the line of code is parsed as a (single) preprocessing-token. In phase 7, this preprocessing token is converted into a user-defined-floating-literal whose ud-suffix component is "T". At no point is the "0." partial token a floating-point literal. At most, it is the fractional-constant component in a bigger user-defined-floating-literal token. Fixes cplusplus#2630.
In translation phase 3, the "0.T" in the line of code is parsed as a (single) preprocessing-token. In phase 7, this preprocessing token is converted into a user-defined-floating-literal whose ud-suffix component is "T". At no point is the "0." partial token a floating-point literal. At most, it is the fractional-constant component in a bigger user-defined-floating-literal token. Fixes cplusplus#2630.
In translation phase 3, the "0.T" in the line of code is parsed as a (single) preprocessing-token. In phase 7, this preprocessing token is converted into a user-defined-floating-literal whose ud-suffix component is "T". At no point is the "0." partial token a floating-point literal. At most, it is the fractional-constant component in a bigger user-defined-floating-literal token. Fixes #2630.
The example in [expr.prim.id.dtor]/3 shows the following line of code:
However, contrary to what the comment suggests, I believe
0.
does not appear as a floating-point literal on this line. I believe that what really appears on this line is the pp-number token0.T
(which is not a valid floating literal token).A very similar case is described in [lex.pptoken]/4:
The text was updated successfully, but these errors were encountered: