-
Notifications
You must be signed in to change notification settings - Fork 7
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
CWG2941 [class.temporary] Lifetime extension for RefType{} #625
Comments
jensmaurer
changed the title
[class.temporary] Lifetime extension for RefType{}
CWG2941 [class.temporary] Lifetime extension for RefType{}
Oct 18, 2024
@jensmaurer, thanks for creating CWG 2941. Some comments:
|
@hubert-reinterpretcast , thanks for your feedback.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Full name of submitter (unless configured in github; will be published with the issue): Hubert Tong
Reference (section label): [class.temporary]
Link to reflector thread (if any): N/A
Issue description:
CWG 2894 will clarify that
RefType{}
produces a glvalue (instead of a prvalue). Once that happens, [class.temporary] will require an update to allow lifetime-extension of any temporary bound to the reference initialized by the function-style cast expression. In particular, the function-style cast is not mapped tostatic_cast
, etc. in this case and the temporary materialization occurs within the initialization for the reference formed by the cast itself.Implementations appear to agree already that such lifetime-extension occurs (https://godbolt.org/z/EWczhzaf6):
Suggested resolution:
Add a bullet to [class.temporary]/6:
a
[ ... ]
a function-style cast to a reference type where the reference is
The text was updated successfully, but these errors were encountered: