/usr/include/X11/X.h #define's None & Bool which means that if it is #include'd before gtest.h, compilation breaks.
Concrete repro: t.cc is:
========================
#ifdef XFIRST
#include <X11/X.h>
#include "gtest/gtest.h"
#else
#include "gtest/gtest.h"
#include <X11/X.h>
#endif
========================
Command line that works: g++ -I/home/fischman/src/chromium/src/testing/gtest/include -c t.cc
Command line that fails: g++ -I/home/fischman/src/chromium/src/testing/gtest/include -c t.cc -DXFIRST
This is with g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3 (on glucid).
Note that this isn't the classic macro name clash that -DGTEST_DONT_DEFINE_FOO=1 works around, because the clash here is between X.h #define'ing None (and Bool) and gtest trying to use those names (even namespace-scoped) as identifiers.
Since X.h is never going to change, and since these symbols are gtest-internal, I'm hoping gtest can be modified to use slightly less generic names.
The stderr of the failing compilation is attached.