You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I compiled without errors or warnings my C++ code in Windows and Linux, but when tried to compile it on Mac OSX, I got this compile-time error below?
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2803: error: incomplete type 'qfloat16' used in type trait expression
In file included from Lobular-Bearing-Plugin_autogen/mocs_compilation.cpp:2:
In file included from Lobular-Bearing-Plugin_autogen/D4ILV6QMEK/moc_table.cpp:9:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:652:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2803:38: error: incomplete type 'qfloat16' used in type trait expression
: public integral_constant<bool, __is_constructible(_Tp, _Args...)>
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:2821:14: note: in instantiation of template class 'std::__1::is_constructible<qfloat16>' requested here
: public is_constructible<_Tp>
^
/Users/nyckstudio/Downloads/lobular-bearing-plugin/include/nlohmann/json.hpp:2727:10: note: in instantiation of template class 'std::__1::is_default_constructible<qfloat16>' requested here
std::is_default_constructible<ConstructibleArrayType>::value and
^
/Users/nyckstudio/Downloads/lobular-bearing-plugin/include/nlohmann/json.hpp:2753:7: note: during template argument deduction for class template partial specialization 'is_constructible_array_type_impl<BasicJsonType, ConstructibleArrayType, enable_if_t<!std::is_same<ConstructibleArrayType, typename BasicJsonType::value_type>::value && std::is_default_constructible<ConstructibleArrayType>::value && (std::is_move_assignable<ConstructibleArrayType>::value || std::is_copy_assignable<ConstructibleArrayType>::value) && is_detected<value_type_t, ConstructibleArrayType>::value && is_detected<iterator_t, ConstructibleArrayType>::value && is_complete_type<detected_t<value_type_t, ConstructibleArrayType> >::value> >' [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>, ConstructibleArrayType = qfloat16]
: is_constructible_array_type_impl<BasicJsonType, ConstructibleArrayType> {};
^
/Users/nyckstudio/Downloads/lobular-bearing-plugin/include/nlohmann/json.hpp:2753:7: note: in instantiation of template class 'nlohmann::detail::is_constructible_array_type_impl<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>, qfloat16, void>' requested here
/Users/nyckstudio/Downloads/lobular-bearing-plugin/include/nlohmann/json.hpp:3099:15: note: in instantiation of template class 'nlohmann::detail::is_constructible_array_type<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer>, qfloat16>' requested here
is_constructible_array_type<BasicJsonType, ConstructibleArrayType>::value and
^
/Users/nyckstudio/Downloads/lobular-bearing-plugin/include/nlohmann/json.hpp:3105:6: note: (skipping 21 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all)
auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr)
^
/Users/nyckstudio/Qt/6.0.1/clang_64/lib/QtCore.framework/Headers/qmetatype.h:2165:42: note: in instantiation of variable template specialization 'QTypeTraits::has_stream_operator_v<QDataStream, nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer> >' requested here
template<typename T, bool = QTypeTraits::has_stream_operator_v<QDataStream, T>>
^
/Users/nyckstudio/Qt/6.0.1/clang_64/lib/QtCore.framework/Headers/qmetatype.h:2265:29: note: in instantiation of default argument for 'QDataStreamOperatorForType<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer> >' required here
/*.dataStreamOut=*/ QDataStreamOperatorForType<T>::dataStreamOut,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/nyckstudio/Qt/6.0.1/clang_64/lib/QtCore.framework/Headers/qmetatype.h:2377:48: note: in instantiation of static data member 'QtPrivate::QMetaTypeInterfaceWrapper<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer> >::metaType' requested here
return &QMetaTypeInterfaceWrapper<Ty>::metaType;
^
/Users/nyckstudio/Qt/6.0.1/clang_64/lib/QtCore.framework/Headers/qmetatype.h:2421:16: note: in instantiation of function template specialization 'QtPrivate::qTryMetaTypeInterfaceForType<qt_meta_stringdata_Dialog_t, QtPrivate::TypeAndForceComplete<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer> &, std::__1::integral_constant<bool, false> > >' requested here
QtPrivate::qTryMetaTypeInterfaceForType<Unique, T>()...
^
Lobular-Bearing-Plugin_autogen/6YEA5652QU/moc_dialog.cpp:111:1: note: in instantiation of variable template specialization 'qt_incomplete_metaTypeArray<qt_meta_stringdata_Dialog_t, QtPrivate::TypeAndForceComplete<void, std::__1::integral_constant<bool, false> >, QtPrivate::TypeAndForceComplete<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string<char>, bool, long long, unsigned long long, double, std::allocator, adl_serializer> &, std::__1::integral_constant<bool, false> >, QtPrivate::TypeAndForceComplete<int, std::__1::integral_constant<bool, false> >, QtPrivate::TypeAndForceComplete<void, std::__1::integral_constant<bool, false> >, QtPrivate::TypeAndForceComplete<void, std::__1::integral_constant<bool, false> >, QtPrivate::TypeAndForceComplete<void, std::__1::integral_constant<bool, false> > >' requested here
qt_incomplete_metaTypeArray<qt_meta_stringdata_Dialog_t
^
/Users/nyckstudio/Qt/6.0.1/clang_64/lib/QtCore.framework/Headers/qdatastream.h:54:7: note: forward declaration of 'qfloat16'
class qfloat16;
^
I had the same issue, moc file in a qt6 project not compiling because qfloat16 is an incomplete type, even though the app code doesn't use qfloat16 anywhere. #include in the headers which lead to this error indeed works around the problem, but it feels like a dirty hack...
This looks like a Qt bug though, see the comment in qdatastream.h:
src/corelib/serialization/qdatastream.h:181: // ### Qt 7: remove the operator or make qfloat16 fully defined, see QTBUG-93499
src/corelib/serialization/qdatastream.h:182: QDataStream &operator<<(qfloat16 f);
Hi, I compiled without errors or warnings my C++ code in Windows and Linux, but when tried to compile it on Mac OSX, I got this compile-time error below?
The header that I'm using is from @karzhenkov, called:
nlohmann_json_qt6_hack.h
nlohmann_json_qt6_hack.h
See Issue #2519
How can I fix it?
The text was updated successfully, but these errors were encountered: