You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the difference between these two? And why do we have MAKE_CONST_MOCK if they are the same?
MAKE_MOCK0(foo, int(), const);
MAKE_CONST_MOCK0(foo, int());
The text was updated successfully, but these errors were encountered:
Hmmm. I have to think about this one. You may have uncovered a bug, but I'm not sure ;-)
The difference is that some support functions are not tagged as const when you write MAKE_MOCKx(name, sig, const), and maybe they should be. The reason for the maybe is that I'm not sure if things would break for noexcept.
There is a difference in how MAKE_CONST_MOCKn works, and adding const as the 3rd macro parameter to MAKE_MOCKn, in that a bunch of helper functions are created that are used when placing expectations. The constness must follow to those helper functions, otherwise it would not be possible to have const/non-const overloads of mock functions. However, a prime use of the 3rd macro parameter is override, and those helper functions do not override virtual functions in any base class, so forwarding the 3rd macro parameter to those functions would cause compilation errors when override is used. If it were possible (perhaps it is?) to filter out override and final from the list of words, then they could be made to be synonymous.
Hi.
What is the difference between these two? And why do we have MAKE_CONST_MOCK if they are the same?
MAKE_MOCK0(foo, int(), const);
MAKE_CONST_MOCK0(foo, int());
The text was updated successfully, but these errors were encountered: