<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:david.majnemer@gmail.com" title="David Majnemer &lt;david.majnemer&#64;gmail.com&gt;"> <span class="fn">David Majnemer</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed" title="RESOLVED WONTFIX - Clang will not accept a conversion from a bound pmf(Pointer to member function) to a regular method pointer. Gcc accepts this." href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D22121&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=pXFwcR5SJ7_BsWLm1Koh6O7eHBblENUwGBDkxfl1Wig&s=6zlUPoowOmiSz63414WPzxt0I71N2tZOsWL4F6_hcVo&e=">bug 22121</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>REOPENED
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>WONTFIX
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed" title="RESOLVED WONTFIX - Clang will not accept a conversion from a bound pmf(Pointer to member function) to a regular method pointer. Gcc accepts this." href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D22121-23c3&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=pXFwcR5SJ7_BsWLm1Koh6O7eHBblENUwGBDkxfl1Wig&s=4ewAh8yzanl3qmu02OR-QwfEsVuDzpXW1Ua1ZxBkWEo&e=">Comment # 3</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed" title="RESOLVED WONTFIX - Clang will not accept a conversion from a bound pmf(Pointer to member function) to a regular method pointer. Gcc accepts this." href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D22121&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=pXFwcR5SJ7_BsWLm1Koh6O7eHBblENUwGBDkxfl1Wig&s=6zlUPoowOmiSz63414WPzxt0I71N2tZOsWL4F6_hcVo&e=">bug 22121</a>
              from <span class="vcard"><a class="email" href="mailto:david.majnemer@gmail.com" title="David Majnemer &lt;david.majnemer&#64;gmail.com&gt;"> <span class="fn">David Majnemer</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=22121#c2">comment #2</a>)
<span class="quote">> (In reply to <a href="show_bug.cgi?id=22121#c1">comment #1</a>)
> > It's a non-conforming extension:
> > <a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__gcc.gnu.org_onlinedocs_gcc-2D4.9.0_gcc_Bound-2Dmember-2Dfunctions.html&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=pXFwcR5SJ7_BsWLm1Koh6O7eHBblENUwGBDkxfl1Wig&s=BBzF83p4Ji-mCnLkFi4mXVbbRXY0SSoxMlCZiDCg3-8&e=">https://gcc.gnu.org/onlinedocs/gcc-4.9.0/gcc/Bound-member-functions.html</a>

> Yes, it is. But there are two reasons for this to be implemented:

> 1. Clang aims to be a GCC drop-in replacement and mimics GCC. If it does so,
> I would expect it to implement all GCC's extensions, at least this one,
> which is probably not so complex.</span >

Clang aims to be as compatible as is reasonable but no closer.  There are some
very prominent GCC extensions which clang will *never* implement.

<span class="quote">> 
> 2. This is a very important feature, which is impossible to replace with any
> other legal construct of the language. This is a huge oversight by the C++
> standard committee that this feature is not available in the language. The
> PMF (pointer to member function) is a much more complicated and not nearly
> as useful construct than a pointer to bound member function, yet the former
> is present in the language, and the latter still isn't.</span >

The feature is fundamentally broken because pointers to member functions don't
result in accessing a vtable when the member function in question is
non-virtual.
Consider the following:
$ cat t.cpp
extern "C" int printf(const char *, ...);

struct A {
  char x;
  void f() { printf("A-in-B [A::f]: %p\n", this); }
};
struct X { virtual ~X() {} char y; };
struct B : X, A {};
extern B b;
typedef void (B::*b_mp)();
typedef void (*b_fptr)(B *);

b_fptr convert(B &b, b_mp mp){
  return (b_fptr)(b.*mp);
}

int main() {
  B b;
  b_mp mp = &A::f;
  printf("B:     [main]: %p\n", &b);
  printf("A-in-B [main]: %p\n", (A *)&b);
  (b.*mp)();
  convert(b, mp)(&b);
}
$ g++ -Wno-pmf-conversions t.cpp -o t && ./t
B:     [main]: 0x7ffde0a7c9f0
A-in-B [main]: 0x7ffde0a7c9f9
A-in-B [A::f]: 0x7ffde0a7c9f9
A-in-B [A::f]: 0x7ffde0a7c9f0

The last printf didn't correctly print out the address of the A-in-B subobject
of B.  This is because GCC can't rely on the fact that there exists a B-to-A
thunk which will perform the this adjustment for us.</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>