Skip to content

CWG2712 [over.match.oper] Unnecessary restriction on built-in assignment operator candidates #279

Closed
cplusplus/draft
#6328
@t3nsor

Description

@t3nsor

Full name of submitter: Brian Bi

Reference (section label): [over.match.oper]

Issue description: As pointed out by Jan Tušil on Stack Overflow, the first bullet in paragraph 5, which (according to my understanding) specifies that a built-in assignment operator candidate is not viable if the implicit conversion sequence required for the left operand would create a temporary, appears to be unnecessary; the second bullet already bans user-defined conversions, and the left parameter (of some type "vq T&", where vq is either "volatile" or empty) will never bind to a temporary in any standard conversion sequence.

Suggested resolution: Edit [over.match.oper]/5:

For the first parameter of the built-in assignment operators, only standard conversion sequences ([over.ics.scs]) are considered. conversions of the left operand are restricted as follows:

  • no temporaries are introduced to hold the left operand, and
  • no user-defined conversions are applied to the left operand to achieve a type match with the left-most
    parameter of a built-in candidate.

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