On Wed, Jan 7, 2015 at 12:31 PM, Marshall Clow <[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 > 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? > > Modified: > > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp > > libcxx/trunk/test/std/utilities/function.objects/negators/binary_negate.pass.cpp > > Modified: > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/divides.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::divides<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, int>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::result_type>::value), "" ); > assert(f(36, 4) == 9); > #if _LIBCPP_STD_VER > 11 > typedef std::divides<> F2; > > Modified: > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/minus.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::minus<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, int>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::result_type>::value), "" ); > assert(f(3, 2) == 1); > #if _LIBCPP_STD_VER > 11 > typedef std::minus<> F2; > > Modified: > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/modulus.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::modulus<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, int>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::result_type>::value), "" ); > assert(f(36, 8) == 4); > #if _LIBCPP_STD_VER > 11 > typedef std::modulus<> F2; > > Modified: > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/multiplies.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::multiplies<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, int>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::result_type>::value), "" ); > assert(f(3, 2) == 6); > #if _LIBCPP_STD_VER > 11 > typedef std::multiplies<> F2; > > Modified: > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/arithmetic.operations/plus.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::plus<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, int>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::result_type>::value), "" ); > assert(f(3, 2) == 5); > #if _LIBCPP_STD_VER > 11 > typedef std::plus<> F2; > > Modified: > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_and.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::bit_and<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, int>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::result_type>::value), "" ); > assert(f(0xEA95, 0xEA95) == 0xEA95); > assert(f(0xEA95, 0x58D3) == 0x4891); > assert(f(0x58D3, 0xEA95) == 0x4891); > > Modified: > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_or.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::bit_or<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, int>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::result_type>::value), "" ); > assert(f(0xEA95, 0xEA95) == 0xEA95); > assert(f(0xEA95, 0x58D3) == 0xFAD7); > assert(f(0x58D3, 0xEA95) == 0xFAD7); > > Modified: > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/bitwise.operations/bit_xor.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::bit_xor<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, int>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::result_type>::value), "" ); > assert(f(0xEA95, 0xEA95) == 0); > assert(f(0xEA95, 0x58D3) == 0xB246); > assert(f(0x58D3, 0xEA95) == 0xB246); > > Modified: > libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/comparisons/equal_to.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::equal_to<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, bool>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<bool, F::result_type>::value), "" ); > assert(f(36, 36)); > assert(!f(36, 6)); > #if _LIBCPP_STD_VER > 11 > > Modified: > libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/comparisons/greater.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::greater<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, bool>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<bool, F::result_type>::value), "" ); > assert(!f(36, 36)); > assert(f(36, 6)); > assert(!f(6, 36)); > > Modified: > libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/comparisons/greater_equal.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::greater_equal<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, bool>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<bool, F::result_type>::value), "" ); > assert(f(36, 36)); > assert(f(36, 6)); > assert(!f(6, 36)); > > Modified: > libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/comparisons/less_equal.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::less_equal<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, bool>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<bool, F::result_type>::value), "" ); > assert(f(36, 36)); > assert(!f(36, 6)); > assert(f(6, 36)); > > Modified: > libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/comparisons/not_equal_to.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::not_equal_to<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, bool>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<bool, F::result_type>::value), "" ); > assert(!f(36, 36)); > assert(f(36, 6)); > #if _LIBCPP_STD_VER > 11 > > Modified: > libcxx/trunk/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/logical.operations/logical_and.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::logical_and<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, bool>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<bool, F::result_type>::value), "" ); > assert(f(36, 36)); > assert(!f(36, 0)); > assert(!f(0, 36)); > > Modified: > libcxx/trunk/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/logical.operations/logical_or.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::logical_or<int> F; > const F f = F(); > - static_assert((std::is_base_of<std::binary_function<int, int, bool>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<bool, F::result_type>::value), "" ); > assert(f(36, 36)); > assert(f(36, 0)); > assert(f(0, 36)); > > Modified: > libcxx/trunk/test/std/utilities/function.objects/negators/binary_negate.pass.cpp > URL: > http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/function.objects/negators/binary_negate.pass.cpp?rev=225375&r1=225374&r2=225375&view=diff > > ============================================================================== > --- > libcxx/trunk/test/std/utilities/function.objects/negators/binary_negate.pass.cpp > (original) > +++ > libcxx/trunk/test/std/utilities/function.objects/negators/binary_negate.pass.cpp > Wed Jan 7 14:31:06 2015 > @@ -19,7 +19,9 @@ int main() > { > typedef std::binary_negate<std::logical_and<int> > F; > const F f = F(std::logical_and<int>()); > - static_assert((std::is_base_of<std::binary_function<int, int, bool>, > F>::value), ""); > + static_assert((std::is_same<int, F::first_argument_type>::value), "" > ); > + static_assert((std::is_same<int, F::second_argument_type>::value), "" > ); > + static_assert((std::is_same<bool, F::result_type>::value), "" ); > assert(!f(36, 36)); > assert( f(36, 0)); > assert( f(0, 36)); > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
