-
Notifications
You must be signed in to change notification settings - Fork 7
CWG2748 [expr.ref] Accessing static members via invalid/null pointer #339
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
Comments
I found the issue, when looking on detection of dangling references/pointer. |
I think, this is slightly different, as this is inconsistency between treatment of |
Ah ok I see |
Full name of submitter (unless configured in github; will be published with the issue): Tomasz Kamiński
Reference (section label): expr.ref
Link to reflector thread (if any):
Issue description:
Given the following definitions:
The behavior of the
(*c).foo
is clearly undefined, as per [expr.ref] p1:So we evaluate
*c
which leads to dereference on the invalid pointer. However in case of thec->foo
, the same wording indicates that we always evalutedc
(expression before allow), which is well-formed. Later per [expr.ref] p2, this get transformed:As this rewrite applies to the reminder of the section, we never indicate that we would evaluate
*E1
in case of the rewrite. So the behvior of accessing static member (data or function) via invalid or null pointer.Suggested resolution:
Move the sentence:
From the end of the p1 to p3 (after p2), so we cleary state that
*E1
is evaluated for the formE1->E2
rewrite. We can also removeor arrow
part.The text was updated successfully, but these errors were encountered: