godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.74k stars 575 forks source link

Fix misunderstandings in GDREGISTER_CLASS (T) #1427

Closed pupil1337 closed 7 months ago

pupil1337 commented 7 months ago

to Fix #1425 When I want to register a non abstract class, I will use GDREGISTER_CLASS() or other macros, But I registered the abstract class through GDREGISTER_CLASS() (possibly because forgot to implement the pure virtual methods), and there were no compilation errors, which would give me some misunderstandings.

It is because if constexpr (!std::is_abstract_v<T>) determined that this class is an abstract class and did not compile memnew(T).

May necessary to confirm that when using GDREGISTER_CLASS(), the memnew(T) must compile. Therefore, when I mistakenly register an abstract class by GDREGISTER_CLASS(), the compiler will give error message.

pupil1337 commented 7 months ago

This PR has been messed up by multiple commits, and the branch is also my master branch. I plan to delete this PR and create a new branch for this modification