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

Including QFlag causes compilation failure with Clang 19, libcpp, and C++23

    XMLWordPrintable

Details

    • Linux/Wayland, Linux/X11
    • 72cde6f7d (dev), 7b0e3fb96 (6.9), d746375d9 (6.8)

    Description

      When building kwin 6.3.0 with Clang 19 and libcpp we're getting the following build error when compiling with "-std=c++23":

       

      In file included from /var/tmp/portage/kde-plasma/kwin-6.3.0/work/kwin-6.3.0/src/osd.cpp:7:
      In file included from /var/tmp/portage/kde-plasma/kwin-6.3.0/work/kwin-6.3.0/src/osd.h:10:
      In file included from /usr/include/qt6/QtCore/QFlags:1:
      In file included from /usr/include/qt6/QtCore/qflags.h:7:
      /usr/include/qt6/QtCore/qcompare_impl.h:26:49: error: no member named 'is_null_pointer_v' in namespace 'std'
         26 |     template <typename T, std::enable_if_t<std::is_null_pointer_v<T>, bool> = true>
            |                                            ~~~~~^
      /usr/include/qt6/QtCore/qcompare_impl.h:26:67: error: 'T' does not refer to a value
         26 |     template <typename T, std::enable_if_t<std::is_null_pointer_v<T>, bool> = true>
            |                                                                   ^
      /usr/include/qt6/QtCore/qcompare_impl.h:26:24: note: declared here
         26 |     template <typename T, std::enable_if_t<std::is_null_pointer_v<T>, bool> = true>
            |                        ^
      /usr/include/qt6/QtCore/qcompare_impl.h:26:77: error: expected member name or ';' after declaration specifiers
         26 |     template <typename T, std::enable_if_t<std::is_null_pointer_v<T>, bool> = true>
            |                                                                             ^
      3 errors generated. 

      "is_null_pointer" is provided by "type_traits" but "qcompare_impl.h" does not include it, adding "#include <type_traits>" to "qcompare_impl.h" fixes the issue (as does reverting to C+20). It appears that "qcompare_impl.h" was relying on a transitive include that's no longer included by libcpp when using C+23.

      Downstream bug reports:

       

      Attachments

        Issue Links

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

          Activity

            People

              peppe Giuseppe D'Angelo
              robholt Robert Holt
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes