error: C2139: 'QString': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_convertible_to'
-
wrote on 26 Apr 2025, 13:33 last edited by WWebber
I ran into exactly the same problem!
Porting from V5.12.x (VS2019) to V6.5.3 (VS2022).
How did you fix this?
The project works perfect with VS2019!
The problem is that the error message does not point to any useful source file than "type_traits". -
@WWebber: Have you tried the suggestion from @kkoehne in https://forum.qt.io/post/765260 ?
-
@WWebber: Have you tried the suggestion from @kkoehne in https://forum.qt.io/post/765260 ?
wrote on 26 Apr 2025, 15:30 last edited by@aha_1980 said in error: C2139: 'QString': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_convertible_to':
@WWebber: Have you tried the suggestion from @kkoehne in https://forum.qt.io/post/765260 ?
It points to 'type_traits' and to exactly this line:
struct is_convertible : bool_constant<__is_convertible_to(_From, _To)> {
// determine whether _From is convertible to _To
};1>C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\type_traits(323,39): error C2139: 'QString': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_convertible_to'
1>(compiling source file '../QT/test.cpp')
1> c:\Qt6\6.5.3\msvc2019_64\include\QtCore\qcontainerfwd.h(30,7):
1> see declaration of 'QString'
1> C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\type_traits(323,39):
1> the template instantiation context (the oldest one first) is
1> c:\Qt6\6.5.3\msvc2019_64\include\QtCore\qstringtokenizer.h(27,30):
1> while compiling class template member function 'QAnyStringView::QAnyStringView(Container &&,wrapped<Container,QString>::type &&)'
1> c:\Qt6\6.5.3\msvc2019_64\include\QtCore\qstringtokenizer.h(27,30):
1> while processing the default template argument of 'QAnyStringView::QAnyStringView(Container &&,wrapped<Container,QString>::type &&)'
1> c:\Qt6\6.5.3\msvc2019_64\include\QtCore\qanystringview.h(216,35):
1> see reference to alias template instantiation 'QAnyStringView::if_convertible_to<QString,QStringTokenizerBaseBase::tokenizer_state&>' being compiled
1> c:\Qt6\6.5.3\msvc2019_64\include\QtCore\qanystringview.h(82,53):
1> see reference to variable template 'const bool conjunction_v<std::negation<std::disjunction<std::is_same<QStringTokenizerBaseBase::tokenizer_state,enum QAnyStringView::Tag>,std::is_sameQStringTokenizerBaseBase::tokenizer_state,QAnyStringView,std::is_pointerQStringTokenizerBaseBase::tokenizer_state,std::is_sameQStringTokenizerBaseBase::tokenizer_state,QByteArray,std::is_sameQStringTokenizerBaseBase::tokenizer_state,QString > >,std::is_convertible<QStringTokenizerBaseBase::tokenizer_state &,QString> >' being compiled
1> c:\Qt6\6.5.3\msvc2019_64\include\QtCore\qanystringview.h(82,53):
1> see reference to class template instantiation 'std::is_convertible<QStringTokenizerBaseBase::tokenizer_state &,QString>' being compiled -
wrote on 27 Apr 2025, 06:29 last edited by
The error shows up with an empty CPP file holding just this single line:
#include <qdialog.h> -
Use a recent Qt version and add the include to QString before.
-
Use a recent Qt version and add the include to QString before.
wrote on 27 Apr 2025, 09:41 last edited by@Christian-Ehrlicher said in error: C2139: 'QString': an undefined class is not allowed as an argument to compiler intrinsic type trait '__is_convertible_to':
Use a recent Qt version and add the include to QString before.
This is unfortunately not an option as I write a DLL for a main application using V6.5.3.
Even when I just include <qstring> in the testcpp, I'm gettig the same error. -
Simply try a recent version to see if it works...
-
wrote on 29 Apr 2025, 16:10 last edited by
Tested with the latest 6.x version - same error.
I suspect it has to do with the latest QT Tools.. -
Try it with a simple CMakeLists.txt on thee visual studio command line.
-
wrote on 30 Apr 2025, 21:34 last edited by
Found it!
This error was caused by the compiler option "/Zc:hiddenFriend-" ! -
19/19