Boost C++ Libraries: Ticket #7230: access to private method using boost::bind https://svn.boost.org/trac10/ticket/7230 <p> It appears that the privacy of a class method is violated with the use of boost::bind in a template class. </p> <p> $ uname -a </p> <p> Linux myhost.mydomain 2.6.32-220.13.1.el6.x86_64 <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1" title="#1: Bugs: boost.build causes ftjam to segfault (closed: Wont Fix)">#1</a> SMP Thu Mar 29 11:46:40 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux </p> <p> $ g++ --version </p> <p> g++ (GCC) 4.4.6 20110731 (Red Hat 4.4.6-3) </p> <pre class="wiki"> #include &lt;boost/bind.hpp&gt; #include &lt;iostream&gt; class base { private: void _private() { std::cout &lt;&lt; "private" &lt;&lt; std::endl; } }; template&lt;class T&gt; class templ { public: void onPrivate(T* t) { // boost::bind(&amp;T::_private, t)(); // error: ‘void base::_private()’ is private boost::bind(&amp;base::_private, t)(); } }; int main(int argc, char **argv) { base b; templ&lt;base&gt; ab; ab.onPrivate(&amp;b); // got into the private parts :) // boost::bind(&amp;base::_private, &amp;b)(); // error: ‘void base::_private()’ is private } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7230 Trac 1.4.3 viboes Mon, 22 Oct 2012 21:56:48 GMT cc set https://svn.boost.org/trac10/ticket/7230#comment:1 https://svn.boost.org/trac10/ticket/7230#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">viboes</span> added </li> </ul> <p> Isn't this a compiler bug? </p> Ticket Peter Dimov Wed, 11 Dec 2013 17:21:16 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/7230#comment:2 https://svn.boost.org/trac10/ticket/7230#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> This is a problem with the specific compiler. </p> Ticket