Skip to content

Commit 71be8c7

Browse files
jcfrusiems
authored andcommitted
chore(generator): Fix deprecated QFlags default constructor warning
This changes the initialization of `m_type_flags` to use `TypeFlag::NoTypeFlags` instead of 0. This resolves a deprecation warning related to the QFlags default constructor in Qt 5.15.2. The warning fixed is: ``` /path/to/PythonQt/generator/typesystem.h:812:11: warning: ‘constexpr QFlags<T>::QFlags(QFlags<T>::Zero) [with Enum = ComplexTypeEntry::TypeFlag; QFlags<T>::Zero = int QFlags<ComplexTypeEntry::TypeFlag>::Private::*]’ is deprecated: Use default constructor instead [-Wdeprecated-declarations] 812 | m_type_flags(0) | ^~~~~~~~~~~~~~~ In file included from /path/to/Qt/5.15.2/gcc_64/include/QtCore/qglobal.h:1304, from /path/to/Qt/5.15.2/gcc_64/include/QtCore/qalgorithms.h:43, from /path/to/Qt/5.15.2/gcc_64/include/QtCore/qlist.h:43, from /path/to/Qt/5.15.2/gcc_64/include/QtCore/QList:1, from /path/to/PythonQt/generator/parser/codemodel_fwd.h:46, from /path/to/PythonQt/generator/parser/codemodel.h:46, from /path/to/PythonQt/generator/abstractmetabuilder.h:45, from /path/to/PythonQt/generator/abstractmetabuilder.cpp:42: /path/to/Qt/5.15.2/gcc_64/include/QtCore/qflags.h:123:80: note: declared here 123 | QT_DEPRECATED_X("Use default constructor instead") Q_DECL_CONSTEXPR inline QFlags(Zero) noexcept : i(0) {} | ^~~~~~ ```
1 parent f4769f1 commit 71be8c7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

generator/typesystem.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ class ComplexTypeEntry : public TypeEntry
794794
{
795795
public:
796796
enum TypeFlag {
797+
NoTypeFlags = 0x0,
797798
ForceAbstract = 0x1,
798799
DeleteInMainThread = 0x2,
799800
Deprecated = 0x4
@@ -809,7 +810,7 @@ class ComplexTypeEntry : public TypeEntry
809810
m_createShell(false),
810811
m_createPromoter(false),
811812
m_noCopy(false),
812-
m_type_flags(0)
813+
m_type_flags(TypeFlag::NoTypeFlags)
813814
{
814815
Include inc;
815816
inc.name = "QVariant";

0 commit comments

Comments
 (0)