Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-39700

QFlag constructors introduce ambiguity under strict compilation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.3.2
    • 5.3.0
    • None
    • Windows. Built on Windows 7 64 bit, with AMD64 as the target.
    • 16dccb24e4e7fb6332f672e1572e7ca359f794c5

    Description

      When using MSVC 2012 (cl 17.0) or 2013 (cl 18.0) with the option "/Za", i.e. disable extensions, many types that use QFlag/QFlags fail to compile.

      An example is the QDir class.

      This originates from the classes declaring enumerations with a mix of positive and negative integers (usually a -1 is declared, e.g. QDir::NoFilter).

      • The enumeration values are passed to the QFlags constructor.
      • A QFlag is implicitly constructed for conversion.
      • The QFlag has multiple constructors, for int and uint, and, because the enumeration matches both, this causes an ambiguity.

      This was not an issue with Qt4 because QFlag only had an int constructor.

      Attachments

        For Gerrit Dashboard: QTBUG-39700
        # Subject Branch Project Status CR V

        Activity

          People

            thiago Thiago Macieira
            chard Richard Hazlewood
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes