[llvm-bugs] [Bug 40524] New: INVOKEing pointer to const&-qualified member function with rvalue results in an error

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 30 04:55:15 PST 2019


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: unassignedclangbugs at nondot.org
          Reporter: lunow at math.hu-berlin.de
                CC: llvm-bugs at lists.llvm.org, mclow.lists at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190130/f281cea8/attachment-0001.html>


More information about the llvm-bugs mailing list