Skip to content

Address of an overloaded template method as a function call argument #167493

@igor-anferov

Description

@igor-anferov

The following piece of code doesn't compile with Clang (21.1.0) while compiling well with GCC (15.2) (see here):

struct S {
    template <class...>
    void f() const& {}
    template <class...>
    void f() & {}
    template <class...>
    void f() && {}
};

template <class R, class Class>
void g(R(Class::*property)() const&) {}

template <class R, class Class>
void g(R(Class::*property)() const) {}

int main() {
    g(&S::f);
}

I think Clang either skips entirely or does poor job at the "template argument deduction" stage of function selection

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"diverges-from:gccDoes the clang frontend diverge from gcc on this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions