Boost C++ Libraries: Ticket #7663: warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used https://svn.boost.org/trac10/ticket/7663 <p> Gennadiy reports in trunk: </p> <p> boost/thread/future.hpp(378) : warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used </p> <p> I get with VC2012 and boost_1_52_0: </p> <p> boost_1_52_0\boost/thread/future.hpp(293): warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used </p> <p> Nigel Pattinson reports a similar issue with VC2008 and unspecified boost version. He finds that: </p> <p> "The comma operator in question is the one in boost/utility/result_of.hpp at line 74 - if I comment that line out everything compiles fine. It is just a warning, so rather than changing result_of.hpp our current workaround is just to disable the warning around the inclusion of future.hpp ." </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/7663 Trac 1.4.3 anonymous Thu, 31 Jan 2013 07:16:40 GMT <link>https://svn.boost.org/trac10/ticket/7663#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:1</guid> <description> <p> The problem also appear with MSVC 10.0, I don't know how to fix it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 06 Feb 2013 08:15:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7663#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:2</guid> <description> <p> The problem also appears with MSVC 11.0 (aka Visual Studio 2012) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Thu, 07 Feb 2013 04:23:48 GMT</pubDate> <title>owner, component, severity changed https://svn.boost.org/trac10/ticket/7663#comment:3 https://svn.boost.org/trac10/ticket/7663#comment:3 <ul> <li><strong>owner</strong> changed from <span class="trac-author">No-Maintainer</span> to <span class="trac-author">Eric Niebler</span> </li> <li><strong>component</strong> <span class="trac-field-old">utility</span> → <span class="trac-field-new">result_of</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Cosmetic</span> → <span class="trac-field-new">Problem</span> </li> </ul> <p> The warning should probably be suppressed in boost/utility/result_of.hpp. I'll investigate. </p> Ticket Zenju Fri, 08 Feb 2013 23:24:16 GMT <link>https://svn.boost.org/trac10/ticket/7663#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:4</guid> <description> <p> I have the same problem, but disabling the warning when including "thread.hpp" is not sufficient. ADL drags in this overload (and thereby the warning) on multiple occasions in my own code when using a member of namespace boost with the commma-operator, e.g. a boost::unique_future: </p> <pre class="wiki"> std::list&lt;boost::unique_future&lt;bool&gt;&gt; dirEx; [...] auto itDirname = dirnames.begin(); for (auto it = dirEx.begin(); it != dirEx.end(); ++it, ++itDirname) [...] </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Sun, 17 Feb 2013 23:56:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7663#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:5</guid> <description> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/82960" title="disable annoying msvc warning, refs #7663">[82960]</a>) disable annoying msvc warning, refs <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7663" title="#7663: Bugs: warning C4913: user defined binary operator ',' exists but no ... (closed: fixed)">#7663</a> </p> </description> <category>Ticket</category> </item> <item> <author>pbf@…</author> <pubDate>Fri, 22 Feb 2013 02:12:38 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7663#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:6</guid> <description> <p> For the record, changelist 82960 does not appear sufficient to fix the problem. In certain circumstances, I still get: </p> <p> future.hpp(354): warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used </p> <p> I've gone so far as to search for all headers that define an operator, overload, and place similar warning disables, however the pesky warning still exists. It's a persistent sucker! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Fri, 22 Feb 2013 02:15:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7663#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:7</guid> <description> <p> I'm afraid there's nothing more I can do besides disabling the warning. If this really doesn't silence the warning for you, then it's a bug in the msvc compiler. You should report it to them. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Fri, 22 Feb 2013 03:53:39 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7663#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:8</guid> <description> <p> I would assume that the warning is issued at the point of overload resolution, not the point where operator, is defined. Thus, disabling the warning in headers that define an operator, wouldn't seem to be enough. </p> </description> <category>Ticket</category> </item> <item> <author>Peter Fry <pbf@…></author> <pubDate>Fri, 22 Feb 2013 05:04:42 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7663#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:9</guid> <description> <p> In the end I've had to work around this by placing the warning disable in boost/config/compiler/visualc.hpp, and therefore ensure it gets disabled wherever I'm using boost (the price you pay for building your code with warn as error and warning level 4). Of course this is fragile since presumably if the first time boost/config.hpp is included, it's placed within a warning disable push/pop block, it may not suppress the warning at the point of overload resolution (thanks to the include guard). I wouldn't therefore propose this as a patch, but hopefully it'll fit my needs. </p> </description> <category>Ticket</category> </item> <item> <author>gast128@…</author> <pubDate>Wed, 06 Mar 2013 18:13:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7663#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:10</guid> <description> <p> We use level 4 and we also have to surpress Boost warnings. For this issue I made 2 other tickets: <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7702" title="#7702: Bugs: warning C4913 (closed: duplicate)">#7702</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7188" title="#7188: Bugs: C4127 in Boost.Range's equal (closed: fixed)">#7188</a> which may be closed then? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Sun, 10 Mar 2013 00:10:42 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/7663#comment:11 https://svn.boost.org/trac10/ticket/7663#comment:11 <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> <p> Fixed in <a class="changeset" href="https://svn.boost.org/trac10/changeset/83381" title="merge [82960] to release, fixes #7663">[83381]</a>. </p> Ticket viboes Sun, 10 Mar 2013 07:53:48 GMT <link>https://svn.boost.org/trac10/ticket/7663#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:12</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/7663#comment:11" title="Comment 11">eric_niebler</a>: </p> <blockquote class="citation"> <p> Fixed in <a class="changeset" href="https://svn.boost.org/trac10/changeset/83381" title="merge [82960] to release, fixes #7663">[83381]</a>. </p> </blockquote> <p> This change set doesn't exists yet ! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Sun, 10 Mar 2013 21:08:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7663#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:13</guid> <description> <p> Sure it does. </p> <pre class="wiki">C:\boost\org\branches\release&gt;svn diff -c 83381 boost\utility\result_of.hpp Index: boost/utility/result_of.hpp =================================================================== --- boost/utility/result_of.hpp (revision 83380) +++ boost/utility/result_of.hpp (revision 83381) @@ -68,6 +68,13 @@ #ifdef BOOST_NO_SFINAE_EXPR +// There doesn't seem to be any other way to turn this off such that the presence of +// the user-defined operator,() below doesn't cause spurious warning all over the place, +// so unconditionally turn it off. +#if BOOST_MSVC +# pragma warning(disable: 4913) // user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used +#endif + struct result_of_private_type {}; struct result_of_weird_type { Property changes on: boost/utility/result_of.hpp ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk/boost/utility/result_of.hpp:r82960 </pre> </description> <category>Ticket</category> </item> <item> <author>Peter Brockamp <p.brockamp@…></author> <pubDate>Thu, 25 Apr 2013 16:05:43 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7663#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:14</guid> <description> <p> This problem still persists in boost V1.53 and it does occur equally to other versions in VS 2005, too! I cannot see the changes mentioned above concerning changeset <a class="changeset" href="https://svn.boost.org/trac10/changeset/83381" title="merge [82960] to release, fixes #7663">[83381]</a> in the source code of the current boost V1.53!?! How come if this was already fixed in V1.52? </p> <p> And I have another remark: </p> <p> Basically it's not this library's fault that this warning is being raised, but on the other hand this warning has its reason! Consider: </p> <p> Overloading the comma-operator could unexpectedly and subliminally alter the functionality of a library or even worse the code of the library's user. The overloaded operator naturally just needs to fit the datatypes given to a call where overload resolution takes place! Therefor every implementor should think twice when overloading operators. </p> <p> Now, there are several places in boost where overloading the comma-operator is being done. These might have their reasons and it is something which is not necessarily being done here but could equally well have been pulled in from another boost library, dunno. However, the warning shows that the compiler saw the operator and considered it for overload-resolution, when compiling some user code - which I regard as being a bad thing! This operator should in my opinion <em>not</em> be automatically visible to user code, as it's just a detail of boost's implementation. Thus, the comma-operator should have been put in a private namespace of the overloading library (not being pulled in by a <code> using ... </code>), so that it is <em>not</em> beeing considered by Koenig-lockup when compiling user code! </p> <p> Here, the emitted warning shows you that luckily(!) things did <em>not</em> get wrong! It says "Hey, I considered the comma-operator for overload-resolution, but the parameter types did not fit, so I used the standard operator." - which is probably what the user intended! So, I think it would be a good thing if boost libraries would encapsulate overloads like this, allowing this warning to be left switched <strong>on</strong>. </p> <p> To come to an end: Disabling this warning is not an optimal solution here (though at the moment unavoidable), things should better be altered accordingly so the warning is not being risen. Maybe with boost's next version? </p> </description> <category>Ticket</category> </item> <item> <author>kovarex@…</author> <pubDate>Sun, 12 May 2013 13:22:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/7663#comment:15 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/7663#comment:15</guid> <description> <p> This warning happened to me when I used boost::circular_buffer&lt;float&gt; (with primitive type), </p> <p> When I did struct Item { </p> <blockquote> <p> float value; </p> </blockquote> <p> }; </p> <p> boost::circular_buffer&lt;Item&gt; instead, it worked fine. (Boost 1.53) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>kkr</dc:creator> <pubDate>Thu, 06 Feb 2014 12:23:08 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/7663 https://svn.boost.org/trac10/ticket/7663 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">chunduru ssc.xps</span> </li> </ul> <p> msword </p> Ticket