Boost C++ Libraries: Ticket #1097: keyword.hpp generates many warnings C4180: qualifier applied to function type has no meaning; ignored https://svn.boost.org/trac10/ticket/1097 <p> KEYWORD_050328_HPP </p> <p> template &lt;class Tag&gt; struct keyword { </p> <blockquote> <p> template &lt;class T&gt; typename aux::tag&lt;Tag, T&gt;::type const </p> <blockquote> <p> <sup></sup><sup></sup><sup></sup><sup></sup><sup> this const is said to be meaningless </sup></p> </blockquote> </blockquote> <p> and could be commented out. </p> <blockquote> <p> operator=(T&amp; x) const { </p> <blockquote> <p> typedef typename aux::tag&lt;Tag, T&gt;::type result; return result(x); </p> </blockquote> <p> } </p> </blockquote> <p> there are several others similar. </p> <p> This creates a blizzard of warnings, even at normal warning level 3. (4180 is a level 1 warning). </p> <p> #ifdef _MSC_VER # pragma warning(disable: 4127) <em> conditional expression is constant. # pragma warning(disable: 4512) </em> assignment operator could not be generated. # pragma warning(disable: 4180) <em> qualifier applied to function type has no meaning; ignored #endif </em></p> <p> produced a quiet compilation. </p> <p> So I suggest either commenting out the const, </p> <p> AND push the above disables, and popping at the end. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1097 Trac 1.4.3 Daniel Wallin Sun, 05 Aug 2007 11:34:56 GMT <link>https://svn.boost.org/trac10/ticket/1097#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1097#comment:1</guid> <description> <p> Which compiler version is this? The <code>const</code> is in fact not meaningless. It's there so that: </p> <pre class="wiki">template &lt;class T&gt; void f(T&amp;); f(_x = 0); </pre><p> can work. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 17 Oct 2007 17:05:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1097#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1097#comment:2</guid> <description> <p> I get a similar problem, this is the simplest code to reproduce it (in msvc-8.0) </p> <pre class="wiki">#include &lt;boost/bind.hpp&gt; template&lt;typename T&gt; struct Foo { Foo(T const&amp; t_) : t(t_) {} T t; }; typedef Foo&lt;int&gt; BarT; //typedef int Bar; class Moo { public: BarT GetBar () { return BarT(42); } }; int main() { Moo moo; boost::bind(&amp;Moo::GetBar, moo); } </pre><p> and the warning: </p> <pre class="wiki">1&gt;boost\boost.1.34.1\boost\boost\bind.hpp(1575) : warning C4180: qualifier applied to function type has no meaning; ignored 1&gt; boost\boost.1.34.1\boost\boost\bind.hpp(1609) : see reference to class template instantiation 'boost::_bi::add_cref&lt;Pm,I&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; Pm=Foo&lt;int&gt; (__thiscall Moo::* )(void), 1&gt; I=1 1&gt; ] 1&gt; test1\test1.cpp(25) : see reference to class template instantiation 'boost::_bi::dm_result&lt;Pm,A1&gt;' being compiled 1&gt; with 1&gt; [ 1&gt; Pm=BarT (__thiscall Moo::* )(void), 1&gt; A1=Moo 1&gt; ] </pre><p> The compiler seems to be choosing the member specialisation of add_cref: </p> <pre class="wiki">template&lt; class M, class T &gt; struct add_cref&lt; M T::*, 1 &gt; { typedef M const &amp; type; // line 1575 }; </pre><p> rather than the member function specialisation: </p> <pre class="wiki">template&lt; class R, class T &gt; struct add_cref&lt; R (T::*) (), 1 &gt; { typedef void type; // line 1580 }; </pre><p> If you change the typedef of Bar to the int, all is well. </p> </description> <category>Ticket</category> </item> <item> <author>gregory.petrosyan@…</author> <pubDate>Wed, 17 Dec 2008 17:27:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1097#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1097#comment:3</guid> <description> <p> this is still true for msvc-9 sp1 </p> <p> are there any plans to "fix" this issue? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Thu, 09 Dec 2010 05:13:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1097#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1097#comment:4</guid> <description> <p> Both gcc 4.2.1 and clang (post 2.8 TOT) compile the sample code above w/o errors or warnings (-Wall, with boost 1.45.0). </p> <p> Is this a msvc-only problem? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Paul A. Bristow</dc:creator> <pubDate>Thu, 09 Dec 2010 09:20:21 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1097#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1097#comment:5</guid> <description> <p> If I remember right, this is a MS compiler error - that will not be fixed. </p> <p> (But the push and pop method may not work - a limit of 50 or so push'n'pops!) </p> <p> I'm not clear what the const does that is useful, so perhaps removing try it? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Mateusz Loskot</dc:creator> <pubDate>Fri, 05 Jul 2013 22:35:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1097#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1097#comment:6</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/1097#comment:2" title="Comment 2">anonymous</a>: </p> <blockquote class="citation"> <p> I get a similar problem, this is the simplest code to reproduce it (in msvc-8.0) ... </p> <pre class="wiki">1&gt;boost\boost.1.34.1\boost\boost\bind.hpp(1575) : warning C4180: qualifier applied to function type has no meaning; ignored 1&gt; boost\boost.1.34.1\boost\boost\bind.hpp(1609) : see reference to class template instantiation 'boost::_bi::add_cref&lt;Pm,I&gt;' being compiled </pre></blockquote> <p> FYI, this warning has been suppressed already by John Maddock in <a class="changeset" href="https://svn.boost.org/trac10/changeset/57542" title="Warning suppressions in Boost.Bind. Fixes #3601.">r57542</a> as part of fix for <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3601" title="#3601: Patches: Patch for warning fixes (closed: fixed)">#3601</a>. </p> <p> Presumably, similar fix could be applied wherever it is necessary to close this report. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Paul A. Bristow</dc:creator> <pubDate>Tue, 09 Jul 2013 13:11:54 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1097#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1097#comment:7</guid> <description> <p> Since MSVC 8 is now well obsolete, I suggest that we just close this ticket. If nobody disagrees, I will close it in a weeks time. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Paul A. Bristow</dc:creator> <pubDate>Fri, 12 Jul 2013 09:24:26 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/1097#comment:8 https://svn.boost.org/trac10/ticket/1097#comment:8 <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">fixed</span> </li> </ul> Ticket