Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

CWG2849 [class.temporary] "temporary object other than a function parameter object" wording is wrong #490

Copy link
Copy link
Closed
cplusplus/draft
#6906
cplusplus/draft#6906
@t3nsor

Description

@t3nsor
Issue body actions

Full name of submitter: Brian Bi

Reference (section label): [class.temporary]

Issue description: From Stack Overflow.

The wording "temporary object other than a function parameter object" does not make sense since a function parameter object is never a temporary object ([class.temporary]/1). In the example that was added during CWG deliberation in Kona (2022) to illustrate this exception, the parameter of f2 is not a temporary in the first place, so there is no exception. Note that in the special case where the implementation creates an extra temporary under [class.temporary]/3, that temporary is not the same as the function parameter object, and its lifetime is unobservable.

Suggested resolution:

Strike "other than a function parameter object" from [class.temporary]/7.

Insert a new note before Example 2 in [stmt.ranged]:

[ Note: A function parameter object is not a temporary object ([class.temporary]), even if its lifetime ends at the end of the full-expression containing the call ([expr.call]). — end note ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.