Several algorithms break with iterators that overload the comma operator. - by Cassio Neri

Status : 

 


1
0
Sign in
to vote
ID 797012 Comments
Status Active Workarounds
Type Bug Repros 0
Opened 8/10/2013 11:06:19 AM
Access Restriction Public

Description

Several algorithms (std::copy, std::transform, ...) break when an iterator overloads the comma operator.

These algorithms use several help functions where loops are written as below:

for (; _First != _Last; ++_Dest, ++_First)

Hence, "++_Dest, ++_First" might be a function call to an overloaded comma operator (which can be found as a iterator member function or by ADL) rather than the built-in comma operator.

Searching for ", ++" in <algorithm>, <xutility> and <xmemory> yields several places where the issue might appear. (I don't know if they are all.)
Sign in to post a comment.
Posted by Microsoft on 2/19/2014 at 11:54 AM
Hi,

Thanks for reporting this bug. We've fixed it, and the fix will be available in the next major version of Visual C++.

I audited all algorithms (in <algorithm>, <numeric>, and <memory>) with all possible iterator strengths, to respect overloaded comma operators by inserting (void) casts. I also audited several container member functions and fixed occurrences there.

Stephan T. Lavavej
Senior Developer - Visual C++ Libraries
stl@microsoft.com
Posted by Microsoft on 8/12/2013 at 1:41 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 8/10/2013 at 11:52 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)