[FR]: MOCK_METHOD should warn on missing comma for function qualifiers
- Dominant language
- C++
- Stars
- 39.5k
- Forks
- 10.9k
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
### Does the feature exist in the most recent commit?
No
### Why do we need this feature?
To prevent bugs.
### Describe the proposal.
Currently, `MOCK_METHOD` expects something like this:
```cpp
MOCK_METHOD(int, GetX, (), (const, override));
```
However we see many people forget the comma for the function qualifiers, and type this instead:
```cpp
MOCK_METHOD(int, GetX, (), (const override)); ^
```
This goes totally unnoticed. The result is that GMock discards the `override` token altogether, which prevents the compiler from enforcing that indeed the function is overriding a virtual function from the base class.
It would be good if GMock could assert this somehow.
### Is the feature specific to an operating system, compiler, or build system version?
No
Contributor guide
Assessment
This issue has not been assessed yet.