Boost C++ Libraries: Ticket #9754: boost::is_function VS compile error (for const operator function) https://svn.boost.org/trac10/ticket/9754 <p> If you try to evaluate boost::is_function on functions that have the same signature and one of them are member const operator function, VC++ (10 through 12) fires compile error: </p> <p> Sample minimal code: </p> <p> struct Functor { </p> <blockquote> <p> void operator()() const {} }; </p> </blockquote> <p> boost::is_function&lt;void()&gt;::value; boost::is_function&lt;decltype(Functor().operator())&gt;::value; </p> <p> Compiler output: 1&gt;$(path)\boost\type_traits\is_function.hpp(72): error C2373: 't' : redefinition; different type modifiers 1&gt; $(path)\boost\type_traits\is_function.hpp(72) : see declaration of 't' 1&gt; $(path)\boost\type_traits\is_function.hpp(97) : see reference to class template instantiation 'boost::detail::is_function_impl&lt;T&gt;' being compiled </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9754 Trac 1.4.3 Yaroslav Lukyanchuk <yarosladov@…> Fri, 07 Mar 2014 11:20:48 GMT attachment set https://svn.boost.org/trac10/ticket/9754 https://svn.boost.org/trac10/ticket/9754 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">sample.cpp</span> </li> </ul> <p> sample code </p> Ticket John Maddock Tue, 22 Apr 2014 11:25:12 GMT <link>https://svn.boost.org/trac10/ticket/9754#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9754#comment:1</guid> <description> <p> I'm not completely sure but I think there's a problem with your use of decltype: gcc for example won't allow it to be used in this way (even if you remove the is_function usage). If you pass the actual type of the member function to is_function then there's no issue. So my suspicion is that is_function is a bystander in this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Thu, 28 May 2015 18:26:51 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9754#comment:2 https://svn.boost.org/trac10/ticket/9754#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> Double checking, I'm pretty sure the code is mal-formed, the correct form is: </p> <p> <code>boost::is_function&lt;decltype(std::declval&lt;Functor&gt;()())&gt;::value;</code> </p> <p> Which does work just fine in your example. </p> Ticket