QFlags: don't provide a constructor from void**
authorMarc Mutz <marc.mutz@kdab.com>
Thu, 20 Sep 2012 14:21:30 +0000 (16:21 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Sat, 22 Sep 2012 17:19:54 +0000 (19:19 +0200)
Use a pointer-to-member instead of void** for Zero, the type that is
used to accept only a literal 0, but not other ints, as QFlags ctor
arguments.

This was developed while trying to find the cause for a build failure
in the qCompare<QIcon> specialisation after adding underlying-enum
detection to QFlags, and it didn't help, but I think it's a saver
alternative to void**, in particular since the ctor in question is
implicit.

Change-Id: I71c67b0b50e9404e4e42836d09d62663296f58af
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
src/corelib/global/qflags.h

index df10441..9b26312 100644 (file)
@@ -77,7 +77,8 @@ Q_DECL_CONSTEXPR inline QIncompatibleFlag::QIncompatibleFlag(int ai) : i(ai) {}
 template<typename Enum>
 class QFlags
 {
-    typedef void **Zero;
+    struct Private;
+    typedef int (Private::*Zero);
     int i;
 public:
     typedef Enum enum_type;