Cast the tr1::tuple_element template parameter to int

Because in `std::tr1::tuple_element` the first template parameter should be of type int (https://gcc.gnu.org/onlinedocs/libstdc++/libstdc++-html-USERS-4.4/a00547.html), but the code inserts a size_t, the first template parameter should be casted to int before, to get rid of the following errors:

googletest-src/googletest/include/gtest/gtest-printers.h:957:60: error: conversion from ‘long unsigned int’ to ‘int’ may change value [-Werror=conversion]
   struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {};

and 

googletest-src/googletest/include/gtest/gtest-printers.h:961:56: error: conversion from ‘long unsigned int’ to ‘int’ may change value [-Werror=conversion]
       const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get(
This commit is contained in:
medithe 2018-07-09 13:36:46 +02:00 committed by GitHub
parent ba96d0b116
commit b50b2f775e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -954,11 +954,11 @@ struct TuplePolicy {
static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value; static const size_t tuple_size = ::std::tr1::tuple_size<Tuple>::value;
template <size_t I> template <size_t I>
struct tuple_element : ::std::tr1::tuple_element<I, Tuple> {}; struct tuple_element : ::std::tr1::tuple_element<static_cast<int>(I), Tuple> {};
template <size_t I> template <size_t I>
static typename AddReference< static typename AddReference<
const typename ::std::tr1::tuple_element<I, Tuple>::type>::type get( const typename ::std::tr1::tuple_element<static_cast<int>(I), Tuple>::type>::type get(
const Tuple& tuple) { const Tuple& tuple) {
return ::std::tr1::get<I>(tuple); return ::std::tr1::get<I>(tuple);
} }