================
@@ -387,9 +388,16 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S,
unsigned DiagID) {
// Do not diagnose use of a comma operator in a SFINAE context because the
// type of the left operand could be used for SFINAE, so technically it is
// *used*.
- if (DiagID != diag::warn_unused_comma_left_operand || !isSFINAEContext())
- DiagIfReachable(Loc, S ? llvm::ArrayRef(S) : std::nullopt,
- PDiag(DiagID) << R1 << R2);
+ if (DiagID == diag::warn_unused_comma_left_operand && isSFINAEContext())
+ return;
+
+ // Don't diagnose discarded left of dot in static class member access
+ // because its type is "used" to determine the class to access
+ if (OrigDiagID == diag::warn_discarded_class_member_access)
+ return;
----------------
Sirraide wrote:
> I think that this warning shouldn't be applied when the thing that is
> discarded is/was dependently typed.
Yeah, I think that makes sense.
> existing warnings about `[[nodiscard]]` values being discarded in new
> positions.
That’s what I would expect, so that also makes sense.
https://github.com/llvm/llvm-project/pull/95112
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits