Boost C++ Libraries: Ticket #4141: typeof/msvc/typeof_impl specializes base class template in derived class https://svn.boost.org/trac10/ticket/4141 <p> This pieces of code from boost/typeof/msvc/typeof_impl.hpp (line 121 in 1.42.0) specializes the base class id2type_tmpl and then declares a local template with the same name. It is marked as a VC8 bugfeature, but I don't know if that is for this reason, or just because it uses the Microsoft in-class specialization feature. </p> <p> We ran into this because our failure to accept this was reported as a bug in the EDG front end's MIcrosoft mode. </p> <p> template&lt;typename ID, typename T&gt; </p> <blockquote> <p> struct msvc_extract_type : msvc_extract_type&lt;ID,msvc_extract_type_default_param&gt; { </p> <blockquote> <p> template&lt;&gt; struct id2type_impl&lt;true&gt; <em>VC8.0 specific bugfeature { </em></p> <blockquote> <p> typedef T type; </p> </blockquote> <p> }; template&lt;bool&gt; struct id2type_impl; </p> </blockquote> </blockquote> <blockquote> <blockquote> <p> typedef id2type_impl&lt;true&gt; id2type; </p> </blockquote> <p> }; </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4141 Trac 1.4.3 Steven Watanabe Thu, 22 Apr 2010 18:54:59 GMT <link>https://svn.boost.org/trac10/ticket/4141#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4141#comment:1</guid> <description> <p> I believe that it is marked as a bugfeature because it specializes a base class template. The tricks needed to make MSVC 8 and up accept a specialization of a base class template in a derived class are fairly arcane. It only worked when the base class and the derived class were both specializations of the same template. Also, declaring another id2type_impl in the derived class appears to be unnecessary. I commented it out, and the tests still pass. </p> </description> <category>Ticket</category> </item> <item> <author>jhs@…</author> <pubDate>Thu, 22 Apr 2010 19:33:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4141#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4141#comment:2</guid> <description> <p> Is is possible to define the specializaiton of id2_type_impl&lt;true&gt; in the base class instead of the derived class? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Thu, 22 Apr 2010 19:52:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4141#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4141#comment:3</guid> <description> <p> No. That's why this hack is only enabled for specific versions of MSVC. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Fri, 30 Apr 2010 17:09:07 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4141#comment:4 https://svn.boost.org/trac10/ticket/4141#comment:4 <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> Ticket