Boost C++ Libraries: Ticket #2289: Problem with BOOST_AUTO and this keyword on VC8/9 https://svn.boost.org/trac10/ticket/2289 <p> On both VC8SP1 and VC9SP1, the code </p> <pre class="wiki">struct foo { int i; foo::foo() { BOOST_AUTO(j, this-&gt;i); } }; </pre><p> results in the compiler error </p> <pre class="wiki"> error C2355: 'this' : can only be referenced inside non-static member functions error C2227: left of '-&gt;i' must point to class/struct/union/generic type error C2955: 'boost::type_of::msvc_typeid_wrapper' : use of class template requires template argument list e:\boostsvn\boost\typeof\msvc\typeof_impl.hpp(209) : see declaration of 'boost::type_of::msvc_typeid_wrapper' </pre><p> In both cases, changing it to simply BOOST_AUTO(j, i); allows it to compile. </p> <p> The foreach lib used to have a similar problem (Ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1652" title="#1652: Bugs: foreach + this keyword -&gt; fails under MSVC (closed: fixed)">#1652</a>), possibly down to the same compiler bug? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2289 Trac 1.4.3 oliora@… Mon, 10 Sep 2012 14:48:22 GMT version changed https://svn.boost.org/trac10/ticket/2289#comment:1 https://svn.boost.org/trac10/ticket/2289#comment:1 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.36.0</span> → <span class="trac-field-new">Boost 1.51.0</span> </li> </ul> <p> Get the same problem in Boost 1.51.0 with VC9 </p> Ticket oliora@… Mon, 10 Sep 2012 14:52:19 GMT <link>https://svn.boost.org/trac10/ticket/2289#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/2289#comment:2</guid> <description> <p> BOOST_AUTO(handler, boost::bind(&amp;Foo::bar, this)); <em> 'this' is a Foo* </em></p> </description> <category>Ticket</category> </item> </channel> </rss>