On Tue, Jul 23, 2013 at 1:30 PM, Enea Zaffanella <span dir="ltr"><<a href="mailto:zaffanella@cs.unipr.it" target="_blank">zaffanella@cs.unipr.it</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello.<br>
<br>
When parsing the following program:<br>
==============================<u></u>=====<br>
$ cat addrof-overloaded.cc<br>
struct S {<br>
static void foo(int);<br>
static void foo(double);<br>
} s;<br>
<br>
typedef void (*PF)(int);<br>
<br>
void test() {<br>
PF pf1 = s.foo; // No error.<br>
PF pf2 = &s.foo; // Error(?)<br>
}<br>
==============================<u></u>=====<br>
<br>
the following parse error is obtained:<br>
==============================<u></u>=====<br>
$ clang++ -fsyntax-only addrof-overloaded.cc<br>
addrof-overloaded.cc:10:12: error: cannot create a non-constant pointer to<br>
member function<br>
PF pf2 = &s.foo; // Error(?)<br>
^~~~~~<br>
1 error generated.<br>
==============================<u></u>=====<br>
<br>
Is this a known bug?<br></blockquote><div><br></div><div>It's not a bug. You can't do that. <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#61">http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_closed.html#61</a></div>
</div>