https://bugs.llvm.org/show_bug.cgi?id=40524

            Bug ID: 40524
           Summary: INVOKEing pointer to const&-qualified member function
                    with rvalue results in an error
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: lu...@math.hu-berlin.de
                CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com

Following code is rejected:

#include <functional>

struct S
{
    void foo() const&;
};

void bar()
{
    (S{}.*&S::foo)(); // OK
    std::mem_fn(&S::foo)(S{}); // Error
}

Bullet point 1.1 of [func.require] reads (citing N4296)
Define INVOKE (f, t1, t2, ..., tN) as follows:
(t1.*f)(t2, ..., tN) when f is a pointer to a member function of a class T and
t1  is an object of
type T or a reference to an object of type T or a reference to an object of a
type derived from T; 

I assume the problem is that T is substituted with S const& when applicability
of that bullet point is checked, but S const& is not a class, so T must be
substituted with S.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to