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

Can't mock a method taking as parameter a type with the same name than the function #152

Open
reddwarf69 opened this issue Jul 19, 2019 · 1 comment

Comments

@reddwarf69
Copy link
Contributor

I tried to mock a method with this signature: void reply(reply) and the compiler complained with:

error: invalid use of non-static member function 
    9 |     TROMPELOEIL_MAKE_MOCK1(reply, void(reply));
      |                                        ^~~~~

So it thinks that the type name is actually the method again.

For better or worse AFAIK the method signature is valid, so it would be good if trompeloeil could mock such a case.

@rollbear
Copy link
Owner

Wow, this is interesting. I agree that it's desirable that it should work, but I have no idea at all about how to make it work. The macro expands to an implementation of the function, and in that function body, the name refers to the function itself and not the type.

It's reasonably easy to work around, though, by being explicit about the name of the type.

https://gcc.godbolt.org/z/jnLh5v

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