> On Jan 12, 2015, at 1:26 PM, David Blaikie <[email protected]> wrote:
> 
> 
> 
> On Fri, Jan 9, 2015 at 3:56 PM, Marshall Clow <[email protected] 
> <mailto:[email protected]>> wrote:
>> On Jan 9, 2015, at 12:17 PM, David Blaikie <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> On Fri, Jan 9, 2015 at 11:35 AM, Marshall Clow <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>>> On Jan 9, 2015, at 9:06 AM, David Blaikie <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> 
>>> 
>>> 
>>> On Wed, Jan 7, 2015 at 12:31 PM, Marshall Clow <[email protected] 
>>> <mailto:[email protected]>> wrote:
>>> Author: marshall
>>> Date: Wed Jan  7 14:31:06 2015
>>> New Revision: 225375
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=225375&view=rev 
>>> <http://llvm.org/viewvc/llvm-project?rev=225375&view=rev>
>>> Log:
>>> In C++03, a bunch of the arithmetic/logical/comparison functors (such as 
>>> add/equal_to/logical_or) were defined as deriving from binary_funtion. That 
>>> restriction was removed in C++11, but the tests still check for this. 
>>> Change the test to look for the embedded types 
>>> first_argument/second_argument/result_type. No change to the library, just 
>>> more standards-compliant tests. Thanks to STL @ Microsoft for the 
>>> suggestion.
>>> 
>>> Are there any tests around to ensure the C++03 behavior remains in C++03? 
>>> Or is that not worth worrying about/preserving/implementing?
>> 
>> The tests will continue to pass if the functors are derived from 
>> binary_function (which is how libc++ implements them).
>> 
>> Other than that, no.
>> 
>> binary_function is an empty struct with three nested typedefs:
>> 
>> template <class Arg1, class Arg2, class Result>
>> struct binary_function
>> {
>>     typedef Arg1   first_argument_type;
>>     typedef Arg2   second_argument_type;
>>     typedef Result result_type;
>> };
>> 
>> The tests (now) check for the existence (and correctness) of 
>> first_argument_type, second_argument_type and result_type.
>> 
>> Right, what I mean is that if/when the functors no longer derive from 
>> binary_function, the tests would continue passing - not catching a 
>> regression for C++03, yes? (libc++ would no longer be a conforming 
>> implementation of C++03?)
> 
> Yes, but when C++03 and C++11 differ, libc++ has consistently chosen the 
> C++11 implementation.
> 
> Do they differ here, or does 11 just offer more flexibility (is the C++03 
> implementation a conforming C++11 implementation, or must the inheritance be 
> removed)

No, the C++03 implementation is a conforming C++11 implementation, _and_ the 
implementation in libc++ is unchanged.
[ and is a conforming C++03 implementation ]

The inheritance is still there in the code.

However, this may change in the future, because the current draft of the C++17 
standard actually *removes* unary_function and binary_function.
Hrm.


> In any case, I think maybe I'm being unclear:
> 
> There's no test to ensure we don't regress the C++03 required behavior, now 
> that these tests have been generalized. It seems like that's a hole/should be 
> fixed?


We could add C++03 specific tests, I suppose. 

— Marshall



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to