Qt6.x QFlags / error C2593: 'operator ==' is ambiguous
-
I have another weird error when porting from 5.x to 6.x.
The project compiles w/o any errors with VS2019 and QT5.x but errors using VS2022 and QT6.x:qmetatype.h(2328,14): error C2593: 'operator ==' is ambiguous
After this there is a huge list of what does not match:
1> could be 'bool QFlagsQt::MouseButton::operator ==(QFlagsQt::MouseButton,QFlagsQt::MouseButton) noexcept' [found using argument-dependent lookup]
1> c:\Qt6\6.5.3\msvc2019_64\include\QtCore\qflags.h(135,34):
1> or 'bool QFlagsQt::Orientation::operator ==(QFlagsQt::Orientation,QFlagsQt::Orientation) noexcept' [found using argument-dependent lookup]
1> c:\Qt6\6.5.3\msvc2019_64\include\QtCore\qflags.h(135,34):
1> or 'bool QFlagsQt::SplitBehaviorFlags::operator ==(QFlagsQt::SplitBehaviorFlags,QFlagsQt::SplitBehaviorFlags) noexcept' [found using argument-dependent lookup]
1> c:\Qt6\6.5.3\msvc2019_64\include\QtCore\qflags.h(135,34):
1> or 'bool QFlagsQt::AlignmentFlag::operator ==(QFlagsQt::AlignmentFlag,QFlagsQt::AlignmentFlag) noexcept' [found using argument-dependent lookup]
...How can I find out, which operator might be missing? Aparently it has somehow to do with QFlags and probable changes in using them.
-
Hi,
You likely have the line in your code that triggers this. What is it ?
-
But it's from your code. Comment all out until the error disappears
-
But it's from your code. Comment all out until the error disappears
@Christian-Ehrlicher said in Qt6.x QFlags / error C2593: 'operator ==' is ambiguous:
But it's from your code. Comment all out until the error disappears
Nice idea, but the error shows up in two moc_*.cpp files holding complex dialogs. Just commenting out the source code but keeping the class frames did not help.
I.e. I cannot recommend to port complex applications from QT5 to 6. Also the latest QT Tools create weird new warnings, I've never seen before.. -
@Christian-Ehrlicher said in Qt6.x QFlags / error C2593: 'operator ==' is ambiguous:
But it's from your code. Comment all out until the error disappears
Nice idea, but the error shows up in two moc_*.cpp files holding complex dialogs. Just commenting out the source code but keeping the class frames did not help.
I.e. I cannot recommend to port complex applications from QT5 to 6. Also the latest QT Tools create weird new warnings, I've never seen before..@WWebber said in Qt6.x QFlags / error C2593: 'operator ==' is ambiguous:
Nice idea, but the error shows up in two moc_*.cpp files holding complex dialogs. Just commenting out the source code but keeping the class frames did not help.
Hi. moc files are generated automatically by Qt's meta object compiler from YOUR source code, and dev's code that generate errors in a moc file aren't a rare issue, it's something I casually encounter. so if there's an error in a moc file, then indirectly there's a problem somewhere in your code that lead to the generation of those files. Probably a Qt error rather than a c++ error. Possibly something that was accepted or tolerated in Qt5 that is no longer in Qt6.
So as already suggested, commenting out come code should allow identify the origin of the errors. Just comment out all the content of one method that you could suspect to be the source of the problem (if method should return something, just add a dummy return value). And if an error disappear, then you found a problem.
Or downright commenting out all the content of all methods and uncommenting them one by one.@WWebber said in Qt6.x QFlags / error C2593: 'operator ==' is ambiguous:
I.e. I cannot recommend to port complex applications from QT5 to 6. Also the latest QT Tools create weird new warnings, I've never seen before..
I've been part of the process. we spent some time on it, but if done with care and methodology, should be rather smooth. Many went on the process before you ;)
-