Works around a gcc bug when compiling tr1/tuple with RTTI disabled.

This commit is contained in:
zhanyong.wan
2009-06-11 03:33:05 +00:00
parent b24b49d85a
commit 683f431d83
3 changed files with 52 additions and 7 deletions

View File

@@ -379,7 +379,21 @@
#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does
// not conform to the TR1 spec, which requires the header to be <tuple>.
#if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
// which is #included by <tr1/tuple>, to not compile when RTTI is
// disabled. _TR1_FUNCTIONAL is the header guard for
// <tr1/functional>. Hence the following #define is a hack to prevent
// <tr1/functional> from being included.
#define _TR1_FUNCTIONAL 1
#include <tr1/tuple>
#undef _TR1_FUNCTIONAL // Allows the user to #include
// <tr1/functional> if he chooses to.
#else
#include <tr1/tuple>
#endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
#else
// If the compiler is not GCC 4.0+, we assume the user is using a
// spec-conforming TR1 implementation.