[clang] [clang-tools-extra] [Clang] Implement CWG2813: Class member access with prvalues (PR #120223)

via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 17 04:44:25 PST 2024


================
@@ -391,16 +397,39 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID) {
   // isn't an array.
   if (E->isGLValue() && E->getType().isVolatileQualified() &&
       !E->getType()->isArrayType()) {
-    Diag(Loc, diag::warn_unused_volatile) << R1 << R2;
+    S.Diag(Loc, diag::warn_unused_volatile) << R1 << R2;
     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 (DiagID == diag::warn_discarded_class_member_access)
+  //  return;
----------------
Sirraide wrote:

I think this can be deleted at this point?

https://github.com/llvm/llvm-project/pull/120223


More information about the cfe-commits mailing list