Closed rainman110 closed 1 month ago
In GitLab by @mariusalexander on Jun 20, 2024, 10:49
On Linux (at least if using gcc) calling NodeData::invoke<T>(...) fails.
gcc
NodeData::invoke<T>(...)
This is because of the way we instantiate QReturnArgument:
QReturnArgument
auto retarg = QReturnArgument<T>(typeid(T).name(), var);
We are using typeid(T) which sadly does not provide portable names for template types. Instead we should be calling it like this:
typeid(T)
auto retarg = Q_RETURN_ARG(MyType, data); // MyType cannot be a template type, since the preprocessor is used here.
where Q_RETURN_ARG expands to:
Q_RETURN_ARG
Q_RETURN_ARG(type, data) QReturnArgument<type >(#type, data)
This goes nicely with the hint in Qt documentation: https://doc.qt.io/qt-5/qgenericreturnargument.html#details
I think just by luck the way we used typeid on windows with "MSVC" yields names that can be unsterstood by Qt. A quick test for double and QString yields the following names:
typeid
with MSVC
typeid(double).name() // "double" typeid(QString).name() // "class QString"
With gcc
typeid(double).name() // "d" typeid(QString).name() // "7QString"
In GitLab by @jensschmeink on Jun 20, 2024, 12:23
mentioned in commit 1255643c293c6734a60399d854eb10442482b790
In GitLab by @mariusalexander on Jun 20, 2024, 10:49
What is the current bug behavior?
On Linux (at least if using
gcc
) callingNodeData::invoke<T>(...)
fails.This is because of the way we instantiate
QReturnArgument
:We are using
typeid(T)
which sadly does not provide portable names for template types. Instead we should be calling it like this:where
Q_RETURN_ARG
expands to:This goes nicely with the hint in Qt documentation: https://doc.qt.io/qt-5/qgenericreturnargument.html#details
I think just by luck the way we used
typeid
on windows with "MSVC" yields names that can be unsterstood by Qt. A quick test for double and QString yields the following names:with MSVC
With gcc