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

QFlags should be a structural type

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.4, 6.0.1, 6.1.1, 6.2.0 FF
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      All

      Description

      I'm classifying this as a bug, because there's no reason it shouldn't be.

      Background:
      C++20 allows class types as non-type template arguments and I found it useful to use a QFlags<Enum> there, but that fails because QFlags isn't "structural". Says GCC 11:

      error: ‘QFlags<QIODevice::OpenModeFlag>’ is not a valid type for a template non-type parameter because it is not structural
      [...]
      qflags.h:165:9: note: ‘QFlags<QIODevice::OpenModeFlag>::i’ is not public
        165 |     Int i;
            |         ^
      

      I'm not sure this is fixable in Qt 6, but it should be fixed for Qt 7, at least.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            mmutz Marc Mutz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes