Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Qt6.x QFlags / error C2593: 'operator ==' is ambiguous
QtWS25 Last Chance

Qt6.x QFlags / error C2593: 'operator ==' is ambiguous

Scheduled Pinned Locked Moved Solved C++ Gurus
7 Posts 4 Posters 163 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WWebber
    wrote last edited by
    #1

    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.

    1 Reply Last reply
    0
    • W Offline
      W Offline
      WWebber
      wrote last edited by
      #7

      Solved!
      I think this error was also related to the compiler option "/Zc:hiddenFriend-".

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote last edited by
        #2

        Hi,

        You likely have the line in your code that triggers this. What is it ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • W Offline
          W Offline
          WWebber
          wrote last edited by WWebber
          #3

          Sry no.
          This error does not point to any line in my source code!
          I also added a forced compilation error to the very end of source file => the 'C2593' error will be thrown after the compilation of the file.

          1 Reply Last reply
          0
          • Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote last edited by
            #4

            But it's from your code. Comment all out until the error disappears

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            W 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              But it's from your code. Comment all out until the error disappears

              W Offline
              W Offline
              WWebber
              wrote last edited by
              #5

              @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..

              C 1 Reply Last reply
              0
              • W WWebber

                @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..

                C Offline
                C Offline
                CassD
                wrote last edited by
                #6

                @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 ;)

                1 Reply Last reply
                4
                • W Offline
                  W Offline
                  WWebber
                  wrote last edited by
                  #7

                  Solved!
                  I think this error was also related to the compiler option "/Zc:hiddenFriend-".

                  1 Reply Last reply
                  0
                  • W WWebber has marked this topic as solved

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved