Skip to content
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.ref] and postfix-expression.template id-expression #4155

Open
languagelawyer opened this issue Sep 8, 2020 · 5 comments
Open

[expr.ref] and postfix-expression.template id-expression #4155

languagelawyer opened this issue Sep 8, 2020 · 5 comments
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.

Comments

@languagelawyer
Copy link
Contributor

[expr.ref]/1:
"""
A postfix expression followed by a dot . or an arrow ->, optionally followed by the keyword template, and then followed by an id-expression, is a postfix expression. The postfix expression before the dot or arrow is evaluated; the result of that evaluation, together with the id-expression, determines the result of the entire postfix expression.
"""
[expr.ref]/3: Abbreviating «postfix-expression.id-expression» as E1.E2, E1 is called the object expression...

And then the subclause describes how the result of «postfix-expression.id-expression», a.k.a. E1.E2, is determined.

But where is it described how the result of «postfix-expression. template id-expression» is determined?

@jensmaurer
Copy link
Member

First of all, this says right in the next sentence
"the result of that evaluation, together with the id-expression, determines the result of the entire postfix expression."
So the "template" obviously doesn't affect the value of the entire postfix expression (it's not mentioned here).

[temp.names] p5 says (essentially) that "template" is only a parser guide.

There are also some changes in this area by the pending omnibus name lookup paper
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p1787r5.html

I'm not seeing a defect here.

@languagelawyer
Copy link
Contributor Author

First of all, this says right in the next sentence
"the result of that evaluation, together with the id-expression, determines the result of the entire postfix expression."

It only claims that the result is determined. How does this answer «how the result of «postfix-expression . template id-expression» is determined?»

So the "template" obviously doesn't affect the value of the entire postfix expression

It could be obvious, but this doesn't seem to be specified by the standard.

[temp.names] p5 says (essentially) that "template" is only a parser guide.

Is [temp.names]/5 the paragraph you wanted to mention? I don't see it there. Could you cite the wording please?

I would just propose

--- a/source/expressions.tex
+++ b/source/expressions.tex
@@ -3224,7 +3224,7 @@ converted to the equivalent form \tcode{(*(E1)).E2}; the remainder of
 
 \pnum
 Abbreviating
-\grammarterm{postfix-expression}\tcode{.}\grammarterm{id-expression}
+\grammarterm{postfix-expression}\tcode{.}\opt{\terminal{template}}\grammarterm{id-expression}
 as \tcode{E1.E2}, \tcode{E1} is called the \defn{object expression}.
 If the object expression is of scalar type,
 \tcode{E2} shall name the pseudo-destructor

but I wasn't sure the form «postfix-expression . template id-expression» is not handler somewhere else.

@jensmaurer
Copy link
Member

"determined": Yes, that's exactly what it says: It says that the result is determined from the postfix-expression before the dot and the id-expression. Note the absence of "template", thus the presence or absence of "template" does not contribute to the determination of the result. Which is exactly what we want.

I think your suggested change is not helpful, because it possibly equates E2 with "template id-expression", which falls apart when we dissect E2 further down.

@languagelawyer
Copy link
Contributor Author

So, you want to say something like: paragraph 1 says that the result is determined by the expression in front of . and the id-expression, but not template. The rest of the subclause speaks about postfix-expression . id-expression and how the result is determined for it. And it should be deduced that for postfix-expression . template id-expression, the result is the same as for postfix-expression . id-expression because the paragraph 1 didn't say that template is involved in result determination? Looks very intricate.

I think your suggested change is not helpful, because it possibly equates E2 with "template id-expression", which falls apart when we dissect E2 further down.

templateopt can be moved out of E2, abbreviating as E1. template[opt] E2.

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Sep 8, 2020
@jensmaurer jensmaurer added cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking. and removed decision-required A decision of the editorial group (or the Project Editor) is required. labels Jun 12, 2023
@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 12, 2023

Editorial meeting consensus: Yes, this does need a bit of clarification, but this should be handled by CWG.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.
Projects
None yet
Development

No branches or pull requests

3 participants