Quuxplusone added a comment. In https://reviews.llvm.org/D45179#1056706, @lebedev.ri wrote:
> gcc does not silence the warning produced by > these attributes via `(void)` cast, unless it's `[[nodiscard]]` attribute :/ > [...] So until they fix that (they will fix that right? :)), > we can only support `_LIBCPP_FORCE_NODISCARD` for clang compilers. The GCC warn_unused_result issue is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509 and also https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425 . I would certainly love for them to fix it, but the sentiment expressed in those bug reports is "no! never! we love being broken!". :/ I re-suggest my idea that perhaps libc++ should respect the user's choice to pass `-D_LIBCPP_NODISCARD=__attribute__((warn_unused_result))` on the GCC command line. This would make your patch only one line longer than it is right now... Repository: rCXX libc++ https://reviews.llvm.org/D45179 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits