On the Mac, code like this:

namespace {
class MyTest : public testing::Test {
};
}  // namespace

TEST_F(MyTest, ATest) {
}

generates errors like this:
warning: ‘MyTest_ATest_Test’ has a field
‘MyTest_ATest_Test::<anonymous>’ whose type uses the anonymous
namespace
warning: ‘MyTest_ATest_Test’ has a base ‘<unnamed>::MyTest’ whose type
uses the anonymous namespace

Removing the namespace fixes it, which is poor because we seem to want
to move towards more anonymous namespace use.  Putting the test case
inside the namespace also fixes it, but is incompatible with
FRIEND_TEST().  This seems to be a gcc 4.2 addition, per:
  http://gcc.gnu.org/gcc-4.2/changes.html

"Members of the anonymous namespace are now local to a particular
translation unit, along with any other declarations which use them,
though they are still treated as having external linkage for language
semantics."

At this point, I'm sort of at the bleeding edge of my knowledge.  For
FRIEND_TEST() cases, it seems like the anonymous namespace needs to
go, but elsewhere it can be changed to enclose the entire file.  Does
that seem reasonable for now?

-scott

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to