Skip to content
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

clang: Warning - destructor called on 'godot::CallableCustomMethodPointerBase' #1272

Closed
capnm opened this issue Oct 17, 2023 · 1 comment · Fixed by #1275
Closed

clang: Warning - destructor called on 'godot::CallableCustomMethodPointerBase' #1272

capnm opened this issue Oct 17, 2023 · 1 comment · Fixed by #1275

Comments

@capnm
Copy link
Contributor

capnm commented Oct 17, 2023

Godot version

current tip (4.2)

godot-cpp version

current tip (4.2) 64eac01

System information

Debian clang version 16.0.6 / 17.0.3

Issue description

  • Breaks a build with env.Append(CCFLAGS='-Werror').
...
clang++ -o godot-cpp/src/variant/projection.linux.template_debug.dev.x86_64.o -c -std=c++17
-fPIC -Wwrite-strings -m64 -march=x86-64 -gdwarf-4 -g3 -Og -DHOT_RELOAD_ENABLED -DLINUX_ENABLED
-DUNIX_ENABLED -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -DDEV_ENABLED
-Igodot-cpp/gdextension -Igodot-cpp/include
-Igodot-cpp/gen/include -Igodot-cpp/src godot-cpp/src/variant/projection.cpp

In file included from godot-cpp/src/variant/callable_method_pointer.cpp:31:
In file included from godot-cpp/include/godot_cpp/variant/callable_method_pointer.hpp:34:
In file included from godot-cpp/include/godot_cpp/core/binder_common.hpp:36:
In file included from godot-cpp/include/godot_cpp/core/method_ptrcall.hpp:36:
In file included from godot-cpp/include/godot_cpp/core/object.hpp:36:
In file included from godot-cpp/include/godot_cpp/core/property_info.hpp:38:
In file included from godot-cpp/include/godot_cpp/variant/variant.hpp:36:
In file included from godot-cpp/gen/include/godot_cpp/variant/builtin_types.hpp:36:
In file included from godot-cpp/gen/include/godot_cpp/variant/string.hpp:38:
In file included from godot-cpp/include/godot_cpp/variant/char_string.hpp:34:
In file included from godot-cpp/include/godot_cpp/templates/cowdata.hpp:37:
godot-cpp/include/godot_cpp/core/memory.hpp:102:3: warning: destructor called on
'godot::CallableCustomMethodPointerBase' that is abstract but has non-virtual destructor 
[-Wdelete-abstract-non-virtual-dtor]
                p_class->~T();
                ^
godot-cpp/src/variant/callable_method_pointer.cpp:44:2: note:
in instantiation of function template specialization
'godot::memdelete<godot::CallableCustomMethodPointerBase>' 
requested here
        memdelete(callable_method_pointer);
        ^
godot-cpp/include/godot_cpp/core/memory.hpp:102:13: note: qualify call to silence this warning
                p_class->~T();
                          ^
                          godot::CallableCustomMethodPointerBase::
clang++ -o godot-cpp/src/core/object.linux.template_debug.dev.x86_64.o -c -std=c++17 -fPIC -Wwrite-strings
-m64 -march=x86-64 -gdwarf-4 -g3 -Og -DHOT_RELOAD_ENABLED -DLINUX_ENABLED -DUNIX_ENABLED
-DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -DDEV_ENABLED -Igodot-cpp/gdextension
-Igodot-cpp/include -Igodot-cpp/gen/include -Igodot-cpp/src godot-cpp/src/core/object.cpp
 warning generated.
...

Steps to reproduce

  • scons use_llvm=yes dev_build=yes optimize=debug

Minimal reproduction project

N/A

@dsnopek
Copy link
Collaborator

dsnopek commented Oct 18, 2023

This is a weird error, given that neither CallableCustomMethodPointerBase or any of it's child classes have explicitly defined destructors, but this should be easy enough to fix: we can just add virtual ~CallableCustomMethodPointerBase() {} to CallableCustomMethodPointerBase.

If you'd like to make a PR that adds this line, I'd happily review it! Otherwise, I'll make the PR myself when I find the time.

capnm added a commit to capnm/godot4-cpp that referenced this issue Oct 19, 2023
Fixes godotengine#1272
+ clang++ (debian v16/v17) warning:
	destructor called on
	'godot::CallableCustomMethodPointerBase' that is abstract but has non-virtual destructor
	[-Wdelete-abstract-non-virtual-dtor]
capnm added a commit to capnm/godot4-cpp that referenced this issue Oct 19, 2023
Fixes godotengine#1272
+ clang++ (debian v16/v17) warning:
	destructor called on
	'godot::CallableCustomMethodPointerBase' that is abstract but has non-virtual destructor
	[-Wdelete-abstract-non-virtual-dtor]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants