aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-25 14:46:00 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-25 14:46:00 +0900
commit5b5eb135be40449a6a63eb9872787bec1ecd0fc2 (patch)
tree94a17c1eb56d60503dbe679b06be672ba65fea35 /lib
parent2213080a13a4eb472c8ac2267efcebc6f0936eb1 (diff)
downloadlibquotient-5b5eb135be40449a6a63eb9872787bec1ecd0fc2.tar.gz
libquotient-5b5eb135be40449a6a63eb9872787bec1ecd0fc2.zip
Have a build-wide macro for compilers that don't handle init-lists right
WORKAROUND_EXTENDED_INITIALIZER_LIST -> BROKEN_INITIALIZER_LISTS is available from util.h now.
Diffstat (limited to 'lib')
-rw-r--r--lib/room.cpp10
-rw-r--r--lib/util.h8
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index c7723832..9340bd58 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -72,14 +72,6 @@ using std::llround;
enum EventsPlacement : int { Older = -1, Newer = 1 };
-// A workaround for MSVC 2015 and older GCC's that don't handle initializer
-// lists right (MSVC 2015, notably, fails with "error C2440: 'return':
-// cannot convert from 'initializer list' to 'QMatrixClient::FileTransferInfo'")
-#if (defined(_MSC_VER) && _MSC_VER < 1910) || \
- (defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 4)
-# define WORKAROUND_EXTENDED_INITIALIZER_LIST
-#endif
-
class Room::Private
{
public:
@@ -1065,7 +1057,7 @@ FileTransferInfo Room::fileTransferInfo(const QString& id) const
total = INT_MAX;
}
-#ifdef WORKAROUND_EXTENDED_INITIALIZER_LIST
+#ifdef BROKEN_INITIALIZER_LISTS
FileTransferInfo fti;
fti.status = infoIt->status;
fti.progress = int(progress);
diff --git a/lib/util.h b/lib/util.h
index 596872e2..f7f646da 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -52,6 +52,14 @@ template <typename T>
static void qAsConst(const T &&) Q_DECL_EQ_DELETE;
#endif
+// MSVC 2015 and older GCC's don't handle initialisation from initializer lists
+// right in the absense of a constructor; MSVC 2015, notably, fails with
+// "error C2440: 'return': cannot convert from 'initializer list' to '<type>'"
+#if (defined(_MSC_VER) && _MSC_VER < 1910) || \
+ (defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 4)
+# define BROKEN_INITIALIZER_LISTS
+#endif
+
namespace QMatrixClient
{
// The below enables pretty-printing of enums in logs