Skip to content

[Bug]: Can't use a fixture from another namespae #4853

@maliberty

Description

@maliberty

Describe the issue

Using a fixture from another namespace leads to compiler errors.

Steps to reproduce the problem

Compiling:

#include "gtest/gtest.h"

namespace X {
class Fixture
{
};
};  // namespace X

TEST_F(X::Fixture, test)
{
}

gives

foo.cc:9:1: error: qualified name does not name a class before ‘:’ token
    9 | TEST_F(X::Fixture, test)
      | ^~~~~~
```


I believe this results from 

```
#define GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
  test_suite_name##_##test_name##_Test
```

generating `class X::Fixture_test_Test : public X::Fixture`

### What version of GoogleTest are you using?

1.13.0

### What operating system and version are you using?

Ubuntu 24.02

### What compiler and version are you using?

g++ (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0


### What build system are you using?

n/a

### Additional context

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions