Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7663: warning C4913: user defined binary operator ', ' exists but no overload could convert all operands, default built-in binary operator ', ' used
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-04-25 16:05:47
#7663: warning C4913: user defined binary operator ',' exists but no overload
could convert all operands, default built-in binary operator ',' used
--------------------------------------+-------------------------------------
Reporter: jeffrey.flinn@⦠| Owner: eric_niebler
Type: Bugs | Status: closed
Milestone: To Be Determined | Component: result_of
Version: Boost 1.52.0 | Severity: Problem
Resolution: fixed | Keywords:
--------------------------------------+-------------------------------------
Comment (by Peter Brockamp <p.brockamp@â¦>):
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 [83381] in the source code of the current boost
V1.53!?! How come if this was already fixed in V1.52?
And I have another remark:
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:
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.
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 //not// 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 {{{ using ... }}}), so that
it is //not// beeing considered by Koenig-lockup when compiling user code!
Here, the emitted warning shows you that luckily(!) things did //not// 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 **on**.
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?
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/7663#comment:14> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:12 UTC