Blacklist use of [[nodiscard]] with Clang

__has_cpp_attribute(nodiscard) is 1 in all compilation modes, but if you
use it outside of C++1z, you get a warning.

LLVM-bug: https://bugs.llvm.org/show_bug.cgi?id=33518
Task-number: QTBUG-61840
Task-number: QTBUG-62085
Change-Id: I84e45059a888497fb55ffffd14d3683f4808978b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Thiago Macieira 2017-07-21 10:22:01 -07:00
parent 50275fbcaf
commit be93d2de03
1 changed files with 2 additions and 1 deletions

View File

@ -1172,7 +1172,8 @@
# define Q_DECL_ALIGN(n) alignas(n)
#endif
#if QT_HAS_CPP_ATTRIBUTE(nodiscard) // P0188R1
#if QT_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
# undef Q_REQUIRED_RESULT
# define Q_REQUIRED_RESULT [[nodiscard]]
#endif