From 041f655c019788f375eec5db95d66e154b1e877b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 12 Aug 2020 14:53:21 +0200 Subject: Use [[nodiscard]] with clang in C++17 mode It is only broken in C++11/c++14 mode. We do need to fix the order of visibility-attributes and this C++ attribute. Change-Id: I41e4367f1aaa9241fec4e336c39e58b798336b2c Reviewed-by: Thiago Macieira --- src/corelib/global/qcompilerdetection.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/global') diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index df68d5acf7..a287bebc26 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1129,8 +1129,8 @@ # define Q_DECL_ALIGN(n) alignas(n) #endif -#if __has_cpp_attribute(nodiscard) && !defined(Q_CC_CLANG) // P0188R1 -// Can't use [[nodiscard]] with Clang, see https://bugs.llvm.org/show_bug.cgi?id=33518 +#if __has_cpp_attribute(nodiscard) && (!defined(Q_CC_CLANG) || __cplusplus > 201402L) // P0188R1 +// Can't use [[nodiscard]] with Clang and C++11/14, see https://bugs.llvm.org/show_bug.cgi?id=33518 # undef Q_REQUIRED_RESULT # define Q_REQUIRED_RESULT [[nodiscard]] #endif -- cgit v1.2.3