Skip to content
This repository has been archived by the owner on Jul 17, 2019. It is now read-only.

Annoying warning when using c++11/14 support #201

Open
lucanus81 opened this issue Feb 10, 2017 · 4 comments
Open

Annoying warning when using c++11/14 support #201

lucanus81 opened this issue Feb 10, 2017 · 4 comments

Comments

@lucanus81
Copy link

Hello,

when using gmock with -Wall -Extra enabled we get a huge number of annoying warnings.
For example
warning: 'virtual testing::internal::Function<bool()>::Result tse::Test(testing::internal::Function<bool(tse::MyTest*)>::Argument1) const' can be marked override [-Wsuggest-override]

I believe the problem is related to how those MOCK_CONST_METHOD_T work, in particular
for c++11 they still generate a method:
virtual ReturnType name(Args)
instead of
ReturnType name(Args) override

Is there any way to avoid this?

Thanks,
Luca

@jwakely
Copy link

jwakely commented Sep 27, 2017

when using gmock with -Wall -Extra enabled we get a huge number of annoying warnings.

Are you sure?

GCC's -Wsuggest-override warning is not enabled by -Wall -Wextra so you must be using that option explicitly.

Is there any way to avoid this?

Don't use -Wsuggest-override if you don't want those warnings.

@lucanus81
Copy link
Author

lucanus81 commented Sep 27, 2017 via email

@jwakely
Copy link

jwakely commented Sep 27, 2017

I'm not a googletest dev, I'm a GCC dev pointing out that you don't get that warning unless you request it.

I suggested a workaround to the warning at google/googletest#1063 (comment)

@lucanus81
Copy link
Author

lucanus81 commented Sep 27, 2017 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants