aaron.ballman added inline comments.
================ Comment at: lib/AST/Decl.cpp:3007 const CXXRecordDecl *Ret = RetType->getAsCXXRecordDecl(); - const auto *MD = dyn_cast<CXXMethodDecl>(this); - if (Ret && !(MD && MD->getCorrespondingMethodInClass(Ret, true))) { + auto OpCode = getOverloadedOperator(); + bool IsPostfix = ---------------- Please don't use `auto` here. ================ Comment at: lib/AST/Decl.cpp:3010 + (OpCode == OO_PlusPlus || OpCode == OO_MinusMinus) && + (this->getNumParams() + (isa<CXXMethodDecl>(this) ? 1 : 0)) == 2; + if (Ret && !IsPostfix) { ---------------- CXXMethodDecl represents a static or instance method, so I'm not certain this logic is quite correct. ================ Comment at: test/SemaCXX/warn-unused-result.cpp:166 +// are special-cased to not warn for return-type due to ubiquitousness. +struct[[clang::warn_unused_result]] S { + S DoThing() { return {}; }; ---------------- Can you also add a test with [[nodiscard]] and verify that the uses of increment/decrement *are* diagnosed? https://reviews.llvm.org/D32207 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits