<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - INVOKEing pointer to const&-qualified member function with rvalue results in an error"
href="https://bugs.llvm.org/show_bug.cgi?id=40524">40524</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>INVOKEing pointer to const&-qualified member function with rvalue results in an error
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>lunow@math.hu-berlin.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>