Skip to content

GB-051 9.3.4.6 [dcl.fct], 9.3.4.7 [dcl.fct.default] Can an explicit object parameter have a default argument? #451

Closed
cplusplus/draft
#5988
@wg21bot

Description

@wg21bot

The syntax and semantics appear to allow:

struct S { void f(S* this = nullptr); };

This is probably no more than an oddity, but perhaps it should be prevented.

Strike this[opt] at the 2nd and 4th occurrence in the grammar of parameter-declaration.
Add a Note: an explicit-object-parameter-declaration cannot have an initializer-clause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions