-
-
Notifications
You must be signed in to change notification settings - Fork 575
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
Add protections against registering classes that didn't use GDCLASS()
#1279
Conversation
What happens if you register a custom class with a built-in parent? The check for I.e. add |
Well, you'd get other compiler errors even without the
Because native classes with However, I suppose it'd be nice to have the |
I'd say that sounds good! At minimum adding the definition to |
002987c
to
a61cdc8
Compare
Just for completeness I'd add: typedef Wrapped self_type; To wrapped, though extending wrapped directly shouldn't happen it'd ensure the check doesn't break (and has parity with the engine) |
I added the stub methods as well as class ExampleNoGDCLASS : public Object {
}; |
Cherry-picked for 4.1 in PR #1281 |
This adds the same protections against registering classes that didn't use
GDCLASS()
, as were added to the engine in PR godotengine/godot#81020This same problem affects godot-cpp, but to a much lesser degree. I was able to reproduce the issue by making a class heirarchy like:
With out this PR, registering
ExampleChild
was allowed to go ahead, which meant really registeringExample
again under a different name. However, with this PR, it gives the compiler errorClass not declared properly, please use GDCLASS.
, just like in the engine.