eranpeer / FakeIt

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

Fix ReturnAndSet() compile error when using incompatible argument types #266

Closed hedayat closed 2 years ago

hedayat commented 2 years ago

Fixes #265

It present a sub-optimal solution for C++ < 17, since it catches type incompatibility problems at runtime rather than during compile time. But at least, it works.

It is probably possible to make it work at compile time, specially for C++14; but I'm not sure I'll go for it.

coveralls commented 2 years ago

Coverage Status

Coverage increased (+9.0e-05%) to 99.926% when pulling 47d24cf881e5c218db236991befb38ae2a1fb260 on hedayat:master into 98979d2784d270514c3d4cde18d4370d1381d866 on eranpeer:master.

FranckRJ commented 2 years ago

I'll look into it this weekend. I'll try as well to make the static check compatible for C++11 (or maybe at least C++14) but I'm afraid that, as you said, it will be a bit too complicated.

hedayat commented 2 years ago

I'll look into it this weekend. I'll try as well to make the static check compatible for C++11 (or maybe at least C++14) but I'm afraid that, as you said, it will be a bit too complicated.

That'd be great. I'm sorry that I'm a bit lazy to work on C++11 compatibility (I consider it too old these days :P ).

FranckRJ commented 2 years ago

I'll admit that I'm a bit lazy as well, I've looked a bit and I have no idea how to make the compile-time check compatible with C++11 (without rewriting a std::get). I'll ship it like that because it fix a bug so the faster it's in a release the better, and support for older versions of C++ can still be improved in a future update, so it's OK I guess.