Closed APokorny closed 7 years ago
I based this proposal on the unique_ptr change because it touches the same code, and I think both are very useful..
... Not looking at the build results so much, but how is this supposed to work? The called function cannot know what arguments there are so it can't remove them from the stack in callee-cleanup environments (MSVC).
Build failed due to a missing file - but yes this is more than undefined behavior.
I think this is extremely helpful when you construct mocks inside fixtures.. Do you have any ideas on how to make that portable?
So this only actually allows you to call functions that have no return value on non-Windows, or functions that have no return value with no arguments reliably. Functions with a trivial return value will "work" but return uninitialized memory (so pointers are whatever rax held at the time of calling, floats can be NaN or denormal accidentally - or heck, an uninitialized FP register causing the FP stack to be unbalanced, other things).
This is why it was not added before.
Ok all in all a bad idea without reflection.. So I will look into making it easy to specify a list of ignored methods..
Nice mocks do not complain when a method is called that is not expected. This is similar to the nice mock concept in GMock. To make use of that feature, just use
NiceMock<Type>()
instead ofMock<Type>()
.