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
Hello,
I have a problem using virtual destructors in classes that I want to mock. The code compiles with clang++ and g++ from mingw on Windows, but it only runs when compiled with g++. The executable created by clang will crash. If I make the destructor non virtual, it will run when compiled with clang++ as well. I compiled without optimizations (-O0) on both compilers.
Minimal code example:
$ g++ --version
g++.exe (Rev2, Built by MSYS2 project) 9.2.0
$ clang++ --version
clang version 10.0.0 (https://github.com/msys2/MINGW-packages.git 3f880aaba91a3d9cdfb222dc270274731a2119a9)
Target: i686-w64-windows-gnu
Thread model: posix
A larger example built with CMake still using mingw clang 10.0.0 gives an error message during compilation. The whole build is still successful, but the executable will crash when run.
D:/git/master/cmake/../../test/fakeit\fakeit.hpp:6142:36: note: in instantiation of template class 'fakeit::FakeObject<IGetDefaultLanguage>' requested here
static_assert(sizeof(C) == sizeof(FakeObject<C, baseclasses...>), "This is a problem");
^
D:/git/master/cmake/../../test/fakeit\fakeit.hpp:8057:35: note: in instantiation of template class 'fakeit::DynamicProxy<IGetDefaultLanguage>' requested here
DynamicProxy<C, baseclasses...> _proxy;
^
D:/git/master/cmake/../../test/fakeit\fakeit.hpp:8307:37: note: in instantiation of template class 'fakeit::MockImpl<IGetDefaultLanguage>' requested here
MockImpl<C, baseclasses...> impl;
^
D:/git/master/test/src/test.cpp:14:31: note: in instantiation of template class 'fakeit::Mock<IGetDefaultLanguage>' requested here
Mock<IGetDefaultLanguage> languageMock;
Using clang from WSL, the executable will run without crashing.
Hello,
I have a problem using virtual destructors in classes that I want to mock. The code compiles with clang++ and g++ from mingw on Windows, but it only runs when compiled with g++. The executable created by clang will crash. If I make the destructor non virtual, it will run when compiled with clang++ as well. I compiled without optimizations (
-O0
) on both compilers.Minimal code example:
G++ and clang++ versions:
A larger example built with CMake still using mingw clang 10.0.0 gives an error message during compilation. The whole build is still successful, but the executable will crash when run.
Using clang from WSL, the executable will run without crashing.
The text was updated successfully, but these errors were encountered: