Details
-
Bug
-
Resolution: Done
-
P4: Low
-
5.9.1
-
None
-
Linux Red Hat 7
-
be93d2de031fb870a1ff244304311e07536a13b9
Description
In Qt 5.9.1, the definition of Q_REQUIRED_RESULT has changed in qcompilerdetection.h
#if QT_HAS_CPP_ATTRIBUTE(nodiscard) // P0188R1 # undef Q_REQUIRED_RESULT # define Q_REQUIRED_RESULT [[nodiscard]] #endif
Compiling our code with gcc (version 6.3.1) with -std=c++ 14 this works fine but when using clang (version 4.0.0) with -std=c++ 14 we get
qcolor.h:194:5: error: use of the 'nodiscard' attribute is a C++1z extension
[-Werror,-Wc++1z-extensions]
We're using C++ 14 with a compiler supporting C++ 1z (clang 4.0.0) but providing -std=c++14. It seems like you ignore compiler arguments with the __has_cpp_attribute check.
define QT_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
You can not force users to set std=c++1z when using a modern compiler.
We are using these cxx flags:
-std=c++14 -pipe -pthread -Wall -Wextra -pedantic -Werror -pedantic-errors
Attachments
Issue Links
- relates to
-
QTBUG-62085 QtScript does not compile
- Closed
For Gerrit Dashboard: QTBUG-61840 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
200638,3 | Blacklist use of [[nodiscard]] with Clang | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |