Repository: godot
Issue: Cannot reinterpret_cast from member pointer type to member pointer type of different size [Clang on Windows]
Labels: bug,platform:windows,topic:core,topic:buildsystem,regression

<!-- Please search existing issues for potential duplicates before filing yours:
https://github.com/godotengine/godot/issues?q=is%3Aissue
-->

**Godot version:**
master 494bf38c76d3070c548a104d56d9f7e164226f1c

**OS/device including version:**
Windows 10 2004 (May 2020)

**Issue description:**
Compiling on Windows with clang 11.0.0, throws a number of "Cannot reinterpret_cast from member pointer type to member pointer type of different size" errors.
<details><summary>Build Errors:</summary>

```
In file included from main\\performance.cpp:31:
In file included from main/performance.h:34:
In file included from .\\core/class_db.h:34:
.\\core/method_bind.h:585:50: error: cannot reinterpret_cast from member pointer type \'float (Performance::*)(Performance::Monitor) const\' to member pointer type \'float (__UnexistingClass::*)(Performance::Monitor) const\' of different size
        MethodBind *a = memnew((MethodBindTRC<R, P...>)(reinterpret_cast<R (MB_T::*)(P...) const>(p_method)));
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\\core/os/memory.h:93:51: note: expanded from macro \'memnew\'
#define memnew(m_class) _post_initialize(new ("") m_class)
                                                  ^~~~~~~
.\\core/class_db.h:235:22: note: in instantiation of function template specialization \'create_method_bind<Performance, float, Performance::Monitor>\' requested here
                MethodBind *bind = create_method_bind(p_method);
                                   ^
main\\performance.cpp:45:11: note: in instantiation of function template specialization \'ClassDB::bind_method<MethodDefinition, float (Performance::*)(Performance::Monitor) const>\' requested here
        ClassDB::bind_method(D_METHOD("get_monitor", "monitor"), &Performance::get_monitor);
                 ^
In file included from main\\performance.cpp:31:
In file included from main/performance.h:34:
In file included from .\\core/class_db.h:34:
.\\core/method_bind.h:317:45: error: cannot reinterpret_cast from member pointer type \'void (Performance::*)(const StringName &, const Callable &, const Vector<Variant> &)\' to member pointer type \'void (__UnexistingClass::*)(const StringName &, const Callable &, const Vector<Variant> &)\' of different size
        MethodBind *a = memnew((MethodBindT<P...>)(reinterpret_cast<void (MB_T::*)(P...)>(p_method)));
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\\core/os/memory.h:93:51: note: expanded from macro \'memnew\'
#define memnew(m_class) _post_initialize(new ("") m_class)
                                                  ^~~~~~~
.\\core/class_db.h:242:22: note: in instantiation of function template specialization \'create_method_bind<Performance, const StringName &, const Callable &, const Vector<Variant> &>\' requested here
                MethodBind *bind = create_method_bind(p_method);
                                   ^
main\\performance.cpp:46:11: note: in instantiation of function template specialization \'ClassDB::bind_method<MethodDefinition, void (Performance::*)(const StringName &, const Callable &, const Vector<Variant> &)>\' requested here
        ClassDB::bind_method(D_METHOD("add_custom_monitor", "id", "callable", "arguments"), &Performance::add_custom_monitor, DEFVAL(Array()));
                 ^
In file included from main\\performance.cpp:31:
In file included from main/performance.h:34:
In file included from .\\core/class_db.h:34:
.\\core/method_bind.h:317:45: error: cannot reinterpret_cast from member pointer type \'void (Performance::*)(const StringName &)\' to member pointer type \'void (__UnexistingClass::*)(const StringName &)\' of different size
        MethodBind *a = memnew((MethodBindT<P...>)(reinterpret_cast<void (MB_T::*)(P...)>(p_method)));
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\\core/os/memory.h:93:51: note: expanded from macro \'memnew\'
#define memnew(m_class) _post_initialize(new ("") m_class)
                                                  ^~~~~~~
.\\core/class_db.h:235:22: note: in instantiation of function template specialization \'create_method_bind<Performance, const StringName &>\' requested here
                MethodBind *bind = create_method_bind(p_method);
                                   ^
main\\performance.cpp:47:11: note: in instantiation of function template specialization \'ClassDB::bind_method<MethodDefinition, void (Performance::*)(const StringName &)>\' requested here
        ClassDB::bind_method(D_METHOD("remove_custom_monitor", "id"), &Performance::remove_custom_monitor);
                 ^
In file included from main\\performance.cpp:31:
In file included from main/performance.h:34:
In file included from .\\core/class_db.h:34:
.\\core/method_bind.h:491:49: error: cannot reinterpret_cast from member pointer type \'bool (Performance::*)(const StringName &)\' to member pointer type \'bool (__UnexistingClass::*)(const StringName &)\' of different size
        MethodBind *a = memnew((MethodBindTR<R, P...>)(reinterpret_cast<R (MB_T::*)(P...)>(p_method)));
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\\core/os/memory.h:93:51: note: expanded from macro \'memnew\'
#define memnew(m_class) _post_initialize(new ("") m_class)
                                                  ^~~~~~~
.\\core/class_db.h:235:22: note: in instantiation of function template specialization \'create_method_bind<Performance, bool, const StringName &>\' requested here
                MethodBind *bind = create_method_bind(p_method);
                                   ^
main\\performance.cpp:48:11: note: in instantiation of function template specialization \'ClassDB::bind_method<MethodDefinition, bool (Performance::*)(const StringName &)>\' requested here
        ClassDB::bind_method(D_METHOD("has_custom_monitor", "id"), &Performance::has_custom_monitor);
                 ^
In file included from main\\performance.cpp:31:
In file included from main/performance.h:34:
In file included from .\\core/class_db.h:34:
.\\core/method_bind.h:491:49: error: cannot reinterpret_cast from member pointer type \'Variant (Performance::*)(const StringName &)\' to member pointer type \'Variant (__UnexistingClass::*)(const StringName &)\' of different size
        MethodBind *a = memnew((MethodBindTR<R, P...>)(reinterpret_cast<R (MB_T::*)(P...)>(p_method)));
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\\core/os/memory.h:93:51: note: expanded from macro \'memnew\'
#define memnew(m_class) _post_initialize(new ("") m_class)
                                                  ^~~~~~~
.\\core/class_db.h:235:22: note: in instantiation of function template specialization \'create_method_bind<Performance, Variant, const StringName &>\' requested here
                MethodBind *bind = create_method_bind(p_method);
                                   ^
main\\performance.cpp:49:11: note: in instantiation of function template specialization \'ClassDB::bind_method<MethodDefinition, Variant (Performance::*)(const StringName &)>\' requested here
        ClassDB::bind_method(D_METHOD("get_custom_monitor", "id"), &Performance::get_custom_monitor);
                 ^
In file included from main\\performance.cpp:31:
In file included from main/performance.h:34:
In file included from .\\core/class_db.h:34:
.\\core/method_bind.h:491:49: error: cannot reinterpret_cast from member pointer type \'unsigned long long (Performance::*)()\' to member pointer type \'unsigned long long (__UnexistingClass::*)()\' of different size
        MethodBind *a = memnew((MethodBindTR<R, P...>)(reinterpret_cast<R (MB_T::*)(P...)>(p_method)));
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\\core/os/memory.h:93:51: note: expanded from macro \'memnew\'
#define memnew(m_class) _post_initialize(new ("") m_class)
                                                  ^~~~~~~
.\\core/class_db.h:235:22: note: in instantiation of function template specialization \'create_method_bind<Performance, unsigned long long>\' requested here
                MethodBind *bind = create_method_bind(p_method);
                                   ^
main\\performance.cpp:50:11: note: in instantiation of function template specialization \'ClassDB::bind_method<MethodDefinition, unsigned long long (Performance::*)()>\' requested here
        ClassDB::bind_method(D_METHOD("get_monitor_modification_time"), &Performance::get_monitor_modification_time);
                 ^
In file included from main\\performance.cpp:31:
In file included from main/performance.h:34:
In file included from .\\core/class_db.h:34:
.\\core/method_bind.h:491:49: error: cannot reinterpret_cast from member pointer type \'Array (Performance::*)()\' to member pointer type \'Array (__UnexistingClass::*)()\' of different size
        MethodBind *a = memnew((MethodBindTR<R, P...>)(reinterpret_cast<R (MB_T::*)(P...)>(p_method)));
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\\core/os/memory.h:93:51: note: expanded from macro \'memnew\'
#define memnew(m_class) _post_initialize(new ("") m_class)
                                                  ^~~~~~~
.\\core/class_db.h:235:22: note: in instantiation of function template specialization \'create_method_bind<Performance, Array>\' requested here
                MethodBind *bind = create_method_bind(p_method);
                                   ^
main\\performance.cpp:51:11: note: in instantiation of function template specialization \'ClassDB::bind_method<MethodDefinition, Array (Performance::*)()>\' requested here
        ClassDB::bind_method(D_METHOD("get_custom_monitor_names"), &Performance::get_custom_monitor_names);
                 ^
7 errors generated.
```

</details>

This is a regression from #42826.

**Steps to reproduce:**
Try compile Godot master on Windows with clang.


**Minimal reproduction project:**
N/A