Open m0ppers opened 7 years ago
It is not a bug. Fakeit will throw an exception (hence the crash) when invoking an un-stubbed method. In order for fakeit to generate a default value it must know the prototype of the method. Standard c++ does not contain any "reflection" mechanism to list the methods of a class, hence you must stub/fake any method you are going to use. The default implementation of an un-stubbed method is to throw an exception. This is the only implementation possible when the return value is unknown.
an unmockedexception is of course expected and would be catched by catch here. this is what happens when you remove the bool or index_t in the code.
However as soon as these are included in the code fakeit will not throw such an exception but simply crash :S
The following code crashes with a segfault:
Compiled like this:
clang++ -g -O0 -std=c++11 -I3rdParty/catch -I3rdParty/fakeit/ tests/mufti.cpp
g++ crashes as well. Also this crashes on mac as well as on linux.
Removing the bool or the index_t fixes the segfault. I think I hit a bug.