eranpeer / FakeIt

C++ mocking made easy. A simple yet very expressive, headers only library for c++ mocking.
MIT License
1.24k stars 170 forks source link

compiler errors #114

Open viktorjucas opened 6 years ago

viktorjucas commented 6 years ago

I added fakeit.hpp to my catch unit test and tried compiling. I am getting several errors that look like this:

../../fakeit.hpp:718:12: error: 'fakeit::EventHandler' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor] struct EventHandler : public VerificationEventHandler { ^

Anybody know what is causing this or how to fix it?

eranpeer commented 6 years ago

Please specify catch and compiler versions.

On Oct 19, 2017 07:36, "viktorjucas" notifications@github.com wrote:

I added fakeit.hpp to my catch unit test and tried compiling. I am getting several errors that look like this:

../../fakeit.hpp:718:12: error: 'fakeit::EventHandler' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor] struct EventHandler : public VerificationEventHandler { ^

Anybody know what is causing this or how to fix it?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/eranpeer/FakeIt/issues/114, or mute the thread https://github.com/notifications/unsubscribe-auth/ACc8gmcpB0rQCPRjQEKqoWty-2RFX_XJks5st15ygaJpZM4P_VJj .

viktorjucas commented 6 years ago

clang version 3.9.0 Catch v1.10.0

I am running with all compiler warnings as errors.

eranpeer commented 6 years ago

Please send the compiler errors log + all flags used. Thanks,

On Fri, Oct 20, 2017 at 1:28 PM, viktorjucas notifications@github.com wrote:

clang version 3.9.0 Catch v1.10.0

I am running with all compiler warnings as errors.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/eranpeer/FakeIt/issues/114#issuecomment-338314371, or mute the thread https://github.com/notifications/unsubscribe-auth/ACc8gmlBXwZYuydOCOjowq1vsWBCP8nQks5suQJ1gaJpZM4P_VJj .

-- Eran 1-424-2504000

eranpeer commented 6 years ago

I took a closer look into this issue. FakeIt hacks the virtual table. This takes some creativity and workarounds to do that. As a result some virtual classes (at least one) in the implementation can't have a virtual destructor. I will try suppressing that error for that specific class. Meantime the only option is not to use this flag when running tests.

viktorjucas commented 6 years ago

Ok. We have very strict checks in place for the overall project. Making an exception when compiling test classes seems reasonable.