From 15fe60cfdada84ea519f08e905d59cc3fb6d20cd Mon Sep 17 00:00:00 2001 From: Kimmo Ollila Date: Sun, 26 Mar 2017 17:38:16 +0300 Subject: [PATCH] Workaround GHS compiler bug This temporary workaround allows to compile with GHS toolchain and should be removed when GHS provides patch to fix the compiler issue. Change-Id: I0d0eac8054e6ba2f448fed3d3c80a518e0d2af97 Reviewed-by: Lars Knoll --- src/widgets/widgets/qlineedit_p.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp index 1d81d1fcb5..68be82c71d 100644 --- a/src/widgets/widgets/qlineedit_p.cpp +++ b/src/widgets/widgets/qlineedit_p.cpp @@ -534,7 +534,19 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE #endif } // If there is a 'before' action, it takes preference + + // There's a bug in GHS compiler that causes internal error on the following code. + // The affected GHS compiler versions are 2016.5.4 and 2017.1 + // This temporary workaround allows to compile with GHS toolchain and should be + // removed when GHS provides a patch to fix the compiler issue. + +#if defined(Q_CC_GHS) + const SideWidgetLocation loc = {position, -1}; + const auto location = before ? findSideWidget(before) : loc; +#else const auto location = before ? findSideWidget(before) : SideWidgetLocation{position, -1}; +#endif + SideWidgetEntryList &list = location.position == QLineEdit::TrailingPosition ? trailingSideWidgets : leadingSideWidgets; list.insert(location.isValid() ? list.begin() + location.index : list.end(), SideWidgetEntry(w, newAction, flags));