From 531d00c1909527cb1bc28f17197267ccde408b0c Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 11 May 2016 10:41:47 +0200 Subject: QML: Fix anchors on Windows. When using an enum type for a bitfield (i.e. Anchors foo : 7), MSVC will somehow store (or interpret) it as signed, while clang/gcc will do it unsigned. This behavior can be made less exciting by specifying the storage type of the enum. However, as the exception that confirms the rule: gcc 4.8 on OpenSUSE 13 will complain that it can't store all Anchor values in a 7 bit bitfield, but ONLY when a base type for an enum is specified. Change-Id: I7514dd613017d321de55560affb9b355fa75fa2e Reviewed-by: Simon Hausmann --- src/quick/items/qquickanchors_p.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/quick/items/qquickanchors_p.h b/src/quick/items/qquickanchors_p.h index d3c8ed82be..2b054e4118 100644 --- a/src/quick/items/qquickanchors_p.h +++ b/src/quick/items/qquickanchors_p.h @@ -89,7 +89,13 @@ public: QQuickAnchors(QQuickItem *item, QObject *parent=0); virtual ~QQuickAnchors(); - enum Anchor { + enum Anchor +#if !(defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && (Q_CC_GNU < 500)) + // Not specifying the enum base type will have MSVC 'interpret' it as signed instead of an unsigned bit-field. + // However, specifying the enum base type breaks GCC 4.x on OpenSUSE 13.something, where it complains that it can't store all values in a 7 bit bitfield. + : uint +#endif + { InvalidAnchor = 0x0, LeftAnchor = 0x01, RightAnchor = 0x02, -- cgit v1.2.3