Modify

Opened 4 years ago

Closed 4 years ago

#7950 closed Patches (fixed)

Eliminate W4-warnings under VS2005 - warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used

Reported by: Peter Brockamp <p.brockamp@…> Owned by: viboes
Milestone: Boost 1.55.0 Component: circular_buffer
Version: Boost 1.52.0 Severity: Cosmetic
Keywords: warnings VS2005 Cc:

Description

Try this code snippet:

#include <boost/circular_buffer.hpp>
#include <boost/date_time.hpp> // Including this causes the warnings

void ProvokeWarnings(void) {
  boost::circular_buffer<int> Test(100);
  Test.set_capacity(500); // This provokes the warnings
}

Compiling this with /W4 in VS2005 will give you a couple of warnings directed towards overloaded coma-operators. Overloading the coma-operator is done in several other libraries and some of them get pulled in to circular_buffer by including date_time.hpp:

\boost\circular_buffer\details.hpp(437) : warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used
\boost\circular_buffer\base.hpp(863) : see reference to function template instantiation 'ForwardIterator boost::cb_details::uninitialized_copy_with_alloc<boost::cb_details::iterator<Buff,Traits>,int*,std::allocator<_Ty>>(InputIterator,InputIterator,ForwardIterator,Alloc &)' being compiled
\boost\circular_buffer\base.hpp(856) : while compiling class template member function 'void boost::circular_buffer<T>::set_capacity(__w64 unsigned int)'
test.cpp(5) : see reference to class template instantiation 'boost::circular_buffer<T>' being compiled
1>        with
1>        [
1>            T=int
1>        ]

Attached a patch which silences these warnings (this is done similarly in other boost libraries fiddling with the coma-operator, circular_buffer is more or less a victim of these warnings here).

Probably it would be better to exclude these (obviously very special) overloads of operator ',' from the ADL in circular_buffer, but this will require changes to the libraries who overload the operator.

Attachments (1)

details.hpp.diff (844 bytes) - added by Peter Brockamp <p.brockamp@…> 4 years ago.
Silence warning C4913 under VS2005

Download all attachments as: .zip

Change History (6)

Changed 4 years ago by Peter Brockamp <p.brockamp@…>

Silence warning C4913 under VS2005

comment:1 Changed 4 years ago by viboes

  • Type changed from Bugs to Patches

comment:2 Changed 4 years ago by viboes

  • Owner changed from jano_gaspar to viboes
  • Status changed from new to assigned

comment:3 Changed 4 years ago by viboes

  • Severity changed from Optimization to Cosmetic
  • Summary changed from Eliminate W4-warnings under VS2005 to Eliminate W4-warnings under VS2005 - warning C4913: user defined binary operator ',' exists but no overload could convert all operands, default built-in binary operator ',' used

comment:4 Changed 4 years ago by viboes

  • Milestone changed from To Be Determined to Boost 1.55.0

Committed revision [84971].

comment:5 Changed 4 years ago by viboes

  • Resolution set to fixed
  • Status changed from assigned to closed

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain viboes.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.