Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
6.9
-
clang-20.1.7
-
-
3f9532836 (dev), 0d1b0c927 (6.10), bec80b7a1 (6.9), 03404c4db (tqtc/lts-6.8), df904d9b0 (tqtc/lts-6.5)
Description
Works fine up to C++23:
#include <QPointer> QPointer<QObject> obj;
Starting from C++26, due to changes in is_virtual_base_of_v apparently:
- libstdc++:
$ clang++ foo.cpp -I/usr/include/qt6/QtCore -I/usr/include/qt6 -DQT_CORE_LIB -I/usr/lib/qt6/mkspecs/linux-g++ -lQt6Core -std=c++26 -w In file included from foo.cpp:1: In file included from /usr/include/qt6/QtCore/QPointer:1: In file included from /usr/include/qt6/QtCore/qpointer.h:7: In file included from /usr/include/qt6/QtCore/qcompare.h:12: In file included from /usr/include/qt6/QtCore/qglobal.h:13: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/15.1.1/../../../../include/c++/15.1.1/type_traits:3697:84: error: incomplete type 'QObject' where a complete type is required 3697 | inline constexpr bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived); | ^ /usr/include/qt6/QtCore/qsharedpointer_impl.h:601:60: note: in instantiation of variable template specialization 'std::is_virtual_base_of_v<QObject, QObject>' requested here 601 | using IfNotVirtualBase = typename std::enable_if<!qxp::is_virtual_base_of_v<T, X>, bool>::type; | ^ /usr/include/qt6/QtCore/qsharedpointer_impl.h:632:68: note: in instantiation of template type alias 'IfNotVirtualBase' requested here 632 | template <class X, IfCompatible<X> = true, IfNotVirtualBase<X> = true> | ^ /usr/include/qt6/QtCore/qsharedpointer_impl.h:634:5: note: while substituting prior template arguments into non-type template parameter [with X = QObject, $1 = true] 634 | QWeakPointer(QWeakPointer<X> &&other) noexcept | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | : d(std::exchange(other.d, nullptr)), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | value(std::exchange(other.value, nullptr)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 637 | { | ~ 638 | } | ~ /usr/include/qt6/QtCore/qsharedpointer_impl.h:591:7: note: while substituting deduced template arguments into function template 'QWeakPointer' [with X = QObject, $1 = (no value), $2 = (no value)] 591 | class QWeakPointer | ^ /usr/include/qt6/QtCore/qpointer.h:18:7: note: while declaring the implicit copy constructor for 'QPointer<QObject>' 18 | class QPointer | ^ foo.cpp:3:22: note: in instantiation of template class 'QPointer<QObject>' requested here 3 | QPointer<QObject> obj; | ^ /usr/include/qt6/QtCore/qtclasshelpermacros.h:139:7: note: forward declaration of 'QObject' 139 | class QObject; | ^ 1 error generated.
- libc++:
clang++ foo.cpp -I/usr/include/qt6/QtCore -I/usr/include/qt6 -DQT_CORE_LIB -I/usr/lib/qt6/mkspecs/linux-g++ -lQt6Core -std=c++26 -w -stdlib=libc++ In file included from foo.cpp:1: In file included from /usr/include/qt6/QtCore/QPointer:1: In file included from /usr/include/qt6/QtCore/qpointer.h:7: In file included from /usr/include/qt6/QtCore/qcompare.h:12: In file included from /usr/include/qt6/QtCore/qglobal.h:13: In file included from /usr/bin/../include/c++/v1/type_traits:449: /usr/bin/../include/c++/v1/__type_traits/is_base_of.h:38:109: error: incomplete type 'QObject' where a complete type is required 38 | _LIBCPP_NO_SPECIALIZATIONS inline constexpr bool is_virtual_base_of_v = __builtin_is_virtual_base_of(_Base, _Derived); | ^ /usr/include/qt6/QtCore/qsharedpointer_impl.h:601:60: note: in instantiation of variable template specialization 'std::is_virtual_base_of_v<QObject, QObject>' requested here 601 | using IfNotVirtualBase = typename std::enable_if<!qxp::is_virtual_base_of_v<T, X>, bool>::type; | ^ /usr/include/qt6/QtCore/qsharedpointer_impl.h:632:68: note: in instantiation of template type alias 'IfNotVirtualBase' requested here 632 | template <class X, IfCompatible<X> = true, IfNotVirtualBase<X> = true> | ^ /usr/include/qt6/QtCore/qsharedpointer_impl.h:634:5: note: while substituting prior template arguments into non-type template parameter [with X = QObject, $1 = true] 634 | QWeakPointer(QWeakPointer<X> &&other) noexcept | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 635 | : d(std::exchange(other.d, nullptr)), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 636 | value(std::exchange(other.value, nullptr)) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 637 | { | ~ 638 | } | ~ /usr/include/qt6/QtCore/qsharedpointer_impl.h:591:7: note: while substituting deduced template arguments into function template 'QWeakPointer' [with X = QObject, $1 = (no value), $2 = (no value)] 591 | class QWeakPointer | ^ /usr/include/qt6/QtCore/qpointer.h:18:7: note: while declaring the implicit copy constructor for 'QPointer<QObject>' 18 | class QPointer | ^ foo.cpp:1516:22: note: in instantiation of template class 'QPointer<QObject>' requested here 1516 | QPointer<QObject> obj; | ^ /usr/include/qt6/QtCore/qtclasshelpermacros.h:139:7: note: forward declaration of 'QObject' 139 | class QObject; | ^ 1 error generated.
Attachments
Issue Links
- resulted from
-
QTBUG-138246 Q{Shared,Weak}Pointer::IfCompatible cause accidental copy/move SMFs, causing FTBFS in qtdeclarative
-
- Reported
-