Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trompeloeil_movable_mock only provides move-ctor #332

Open
DNKpp opened this issue Apr 10, 2024 · 3 comments
Open

trompeloeil_movable_mock only provides move-ctor #332

DNKpp opened this issue Apr 10, 2024 · 3 comments

Comments

@DNKpp
Copy link
Contributor

DNKpp commented Apr 10, 2024

Trompeloeil's mocks should be movable, when the bool member trompeloeil_movable_mock is set to true. But currently it is limited to move-construction; move-assignment is not supported. Is there a reason for this? Or is it just a bug?
A simple fix would be just the line: expectations& operator =(expectations&&) = default; in the struct expectations definition.

Btw, as a side-note: it's never a good idea to explicitly specify noexcept on defaulted functions, as this is can and will be overriden by compilers. => expectations(expectations&&) noexcept = default;

@rollbear
Copy link
Owner

Is this a question from a philosophical point of view, or do you have a real world use case?

The latter seems to be a mistake (unless it was added as a work-around for some old compiler, I don't remember). I'll remove it (possibly conditionally depending on compiler).

@DNKpp
Copy link
Contributor Author

DNKpp commented Apr 16, 2024

Well, I often stumble across this. I sometimes simply want to setup expectations on a mock and then move it somewhere and do not care, whether it's moved somewhere else or not.
The most annoying fact is, that mock types can not be used as template types, where std::movable (or any depending concept) is required.

@rollbear
Copy link
Owner

OK. Thanks. I'll look into it. I'm somewhat afraid that it'll open a can of worms, but I understand your situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants