-
Notifications
You must be signed in to change notification settings - Fork 38
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
Equivalent function definitions fail at C++ compilation #1982
Comments
I don't think we actually need to allow this. Spicy doesn't need functions to be declared before usage, i.e., no need for prototypes if the implementation can be found somewhere else. The main use case for a body-less prototype are |
Probably not, I assumed since it was valid that there was more use. Does that mean we can just decline any prototypes without FWIW, I think this is still necessary for hooks, and is why my initial implementation wasn't in the initial PR for overloading - I ran the tests, saw failures that looked valid, and stopped. But if we just allow equivalent hooks it seems fine :) Like this from
This can probably done pretty easily after or alongside #1985 - I'd prefer a diagnostic on non-hook prototypes without |
Yes, I think so (assuming there's no other attribute I'm missing right now that would need prototypes too; but as long as the test suite passes we should be fine).
Yeah, right, because hooks may have no implementation at all.
+1 |
Found during #1978
These functions are equivalent and have a body so they should be rejected, instead they fail at C++ compilation:
This is a little more complicated since I believe this should still be allowed:
But a naive implementation just checking if the first name declaration has a body misses this case:
error for reference:
The text was updated successfully, but these errors were encountered: