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

Add const qualifiers to copy constructors #303

Closed seva-deriv closed 1 year ago

coveralls commented 1 year ago

Coverage Status

Coverage remained the same at 99.925% when pulling 70f1f4ecb0f3444268bcecc650d02703c8f28e7c on seva-deriv:copy_ctor into 49b27fec50c180870ab8b435907f12146dbf3063 on eranpeer:master.

seva-deriv commented 1 year ago

I've got a wierd compilation error (on Clang 14.0.1 Ubuntu 22.04, looks like a bug in compiler):

fakeit.hpp:9142:20: error: no matching constructor for initialization of 'MethodProgress<boost::asio::awaitable<void>, *****>'
            return progress;
                   ^~~~~~~~
fakeit.hpp:9114:13: note: candidate constructor not viable: expects an lvalue for 1st argument
            MethodProgress(MethodProgress &other) :
            ^

This change fixed that and it also seems to be more generic and widely used.

I may also propose just to remove ctors that look like defaulted.

FranckRJ commented 1 year ago

Thanks, it should fix #302. And just to be sure, it happens only when compiling in C++23, no ?

seva-deriv commented 1 year ago

Not sure if only in C++23 but indeed it happened when compiled in C++23