Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Seems like tonight it's <a href="https://stackoverflow.com/questions/15079947/obviously-ambiguous-call-does-not-cause-a-compilation-error-on-gcc#comment21209484_15079947">GCC Bug Party</a> :-)</p> <p>Jokes aside, this is most certainly a <strong>bug</strong>. <a href="https://stackoverflow.com/questions/15080015/stdthread-with-pointer-to-data-member/15080378#15080378">My answer to the linked question</a> actually contains the proof, but since it is not emphasized, I will repeat it here.</p> <p>This is how the <code>INVOKE</code> facility, in terms of which the behavior of <code>std::thread</code>'s constructor (see the linked answer) is defined in the C++11 Standard</p> <blockquote> <p>Define <strong>INVOKE (f, t1, t2, ..., tN)</strong> as follows:</p> <p>— <strong>(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;</strong></p> <p>— ((*t1).*f)(t2, ..., tN) when f is a pointer to a member function of a class T and t1 is not one of the types described in the previous item;</p> <p>— t1.*f when N == 1 and f is a pointer to member data 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;</p> <p>— (*t1).*f when N == 1 and f is a pointer to member data of a class T and t1 is not one of the types described in the previous item;</p> <p>— f(t1, t2, ..., tN) in all other cases.</p> </blockquote> <p>The sentence in bold font effectively specifies that the line:</p> <blockquote> <p>std::thread t(&amp;S::f, s);</p> </blockquote> <p>Should compile. Therefore, this qualifies as a <strong>bug</strong>.</p> <p>Besides, that does line compile on GCC 4.8.0 (beta) and Clang 3.2.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload