Skip to content

[over.oper.general] default arguments for operator[] #5131

@jensmaurer

Description

@jensmaurer

See P2128R6

In 12.4.1 [over.oper.general], the 10-th clause is stated as follows:

An operator function cannot have default arguments (9.3.4.7), except where explicitly stated below. Operator functions cannot have more or fewer parameters than the number required for the corresponding operator, as described in the rest of 12.4.

I think this clause is why that last clause (12.4.4, [over.call]) need to specify

A function call operator function is a function named operator() that is a non-static member function with an arbitrary number of parameters. It may have default arguments. For an expression of the form

Therefore for consistency between operator() and operator[], and be more clear with specification, I think we should specify It may have default arguments in [over.sub] too.

Originally posted by @Mick235711 in #4997 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    not-editorialIssue is not deemed editorial; the editorial issue is kept open for tracking.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions