Godot version
4.3.dev(29b3d9e)
godot-cpp version
4.3.dev(a62f633)
System information
windows 11
Issue description
Created an Abstract class that inherits from Node. When I registered this class using GDREGISTER_CLASS() in register_types.cpp and compiled the project, the C++ did not report any errors.
Open the engine, and selecte this class to create a root node, it will print error:

The expected result is that when I register an abstract class with GDREGISTER_CLASS(), the project cannot be compiled.
I analyzed and it seems that the following code caused the class constructor to be skipped during compilation:
// class_db.hpp
template <class T>
static GDExtensionObjectPtr _create_instance_func(void *data) {
if constexpr (!std::is_abstract_v<T>) {
T *new_object = memnew(T);
return new_object->_owner;
} else {
return nullptr; // <- will execute this line
}
}
Steps to reproduce
- create an abstract class like:
class Foo : public Node {
GDCLASS(Foo, Node)
virtual void func() = 0;
};
- register class in register_types.cpp:
Minimal reproduction project
N/A
Godot version
4.3.dev(29b3d9e)
godot-cpp version
4.3.dev(a62f633)
System information
windows 11
Issue description
Created an Abstract class that inherits from Node. When I registered this class using GDREGISTER_CLASS() in register_types.cpp and compiled the project, the C++ did not report any errors.
Open the engine, and selecte this class to create a root node, it will print error:

The expected result is that when I register an abstract class with GDREGISTER_CLASS(), the project cannot be compiled.
I analyzed and it seems that the following code caused the class constructor to be skipped during compilation:
Steps to reproduce
compile the project, will successed.
open the engine and create this class with error
Minimal reproduction project
N/A