Skip to content

Clang rejects valid program when using function call operator #100547

Open
@ranaanoop

Description

@ranaanoop

The following valid program is rejected by clang: Demo

struct A {
    A() {}
    A(A&&) = default;
    void f(this A) {}
    void operator() (this A) {}
};

int main() {
    A{}.f(); // ok
    A{}();   // Clang rejects while gcc and msvc accepts 
}

As per over.call, the expression A{}() is equivalent to(interpreted as) A{}.operator()() which clang accepts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyrejects-valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions