Googletest: Support "noexcept" function specifiers

Created on 10 Sep 2018  路  5Comments  路  Source: google/googletest

I've been waiting for this feature for quite a while now, but the original issue #667 has been closed recently due to inactivity. Given the fact that googletest will drop support for c++98 soon, I'd expect that a language feature like noexcept should be supported.

667 was referencing PR #681, which was then dropped in favour of PR #794 and PR #1168. PR #1168 has been dropped in favour of solutions discussed in issue #948, which lead to PR #1532. Unfortunately PR #1532 is close to be merged, but does not include support for noexcept anymore.

Most helpful comment

I am also in need of this, especially now that noexcept is part of the type system and compilers are starting to flag noexcept mismatches as errors.

All 5 comments

I am also in need of this, especially now that noexcept is part of the type system and compilers are starting to flag noexcept mismatches as errors.

Thank you very much for this report. The best way to approach this would be to create a proper PR and submit it for consideration.

@ugoren ping

"noexcept" is supported in the latest gmock, or not?

I don't know since when, but it works now. Syntax is described here and all you need to do is to change

MOCK_METHOD(int, GetSize, (), (const, override)); // override is optional

to

MOCK_METHOD(int, GetSize, (), (const, override, noexcept)); // override is optional

Please, close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

markfrazzetto picture markfrazzetto  路  3Comments

ElectricRCAircraftGuy picture ElectricRCAircraftGuy  路  4Comments

AstralStorm picture AstralStorm  路  4Comments

kuzkry picture kuzkry  路  6Comments

ebioman picture ebioman  路  3Comments