-
-
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
GDCLASS macro prohibits use of pure virtual functions #1287
Comments
Thanks! This is a tricky one. Since Godot modules can register abstract classes, we want to allow godot-cpp to do so as well. However, we also want to try to mimic the module API as much as possible, and in a module, you can use Maybe there's a way to move the generation of the Something like this super incomplete psuedo code:
And then when registering abstract classes, we wouldn't use that, we'd just use Hopefully that idea makes sense :-) |
@dsnopek So I see that |
Is there some sort of |
There is |
Rework GDCLASS macro to allow abstract classes
Godot version
4.2 beta3
godot-cpp version
4.2 beta3
System information
Windows 11
Issue description
When trying to create a GDExtension abstract class, the compiler fails to allow pure virtual functions, reporting:
This is because the
GDCLASS
macro explicitly makes two references to where it attempts to create the class object, specifically in these two static methods:The ability to use
GDCLASS
in GDNative and construct abstract classes exists. I would suggest thatGDCLASS
function like it does in GDNative and these two specific methods be added to either a separate macro or we introduce a newGDCLASS_ABSTRACT
macro that can be used specifically for abstract class construction with all but the above 2 functions defined.Steps to reproduce
Create a class hierarchy as follows
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: