comipayan / googletest

Automatically exported from code.google.com/p/googletest
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Visual Studio 2010 Express does not compile googletest due to tuple issue #225

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Open msvc/gtest.sln in Visual Studio 2010 Express
2. Set build to Release
3. Build->Build Solution (F7)

What is the expected output? What do you see instead?

I excepected a successful build.  

1>C:\googletest\include\gtest/internal/gtest-tuple.h(883): error C2039:
'type' : is not a member of 'std::tr1::tuple_element'
1>          C:\googletest\include\gtest/internal/gtest-tuple.h(743) : see
declaration of 'std::tr1::tuple_element'
1>C:\googletest\include\gtest/internal/gtest-tuple.h(883): error C2146:
syntax error : missing ',' before identifier 'type'
1>C:\googletest\include\gtest/internal/gtest-tuple.h(883): error C2065:
'type' : undeclared identifier

What version of the product are you using? On what operating system?

SVN and 1.4.0 both exhibit this problem.  Attempted on Visual Studio 2010
Express Beta 2 and Vista.

Original issue reported on code.google.com by litgh...@gmail.com on 23 Nov 2009 at 8:50

GoogleCodeExporter commented 9 years ago
We will track it in the issue 217. A workaround is suggested there.

Original comment by vladlosev on 23 Nov 2009 at 11:59

GoogleCodeExporter commented 9 years ago
A simple temporary solution to make his/her code to compile is to move the
tuple_element structure to the gtest_internal namespace as it is incompatible 
with
the other definition in MSVC tuple header.

I fixed it by changing in gtest-tuple.h (line 741):

//--------------------------
template <int k, class Tuple>
struct tuple_element {
  typedef typename gtest_internal::TupleElement<
      k < (tuple_size<Tuple>::value), k, Tuple>::type type;
};

#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename tuple_element<k, Tuple >::type
//--------------------------

 to 

//--------------------------
namespace gtest_internal {

template <int k, class Tuple>
struct tuple_element {
  typedef typename TupleElement<
      k < (tuple_size<Tuple>::value), k, Tuple>::type type;
};

} //namespace gtest_internal

#define GTEST_TUPLE_ELEMENT_(k, Tuple) typename gtest_internal::tuple_element<k,
Tuple >::type
//--------------------------

Original comment by radoslaw...@gmail.com on 9 Jan 2010 at 2:26

GoogleCodeExporter commented 9 years ago
this is a dup of issue 217, which is fixed in the 
trunk.

Original comment by w...@google.com on 9 Jan 2010 at 5:34