cor3ntin added inline comments.

================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:4016-4019
+  // Ensure that `-Wunused-variable` will be emitted for condition variables
+  // that are not referenced later. e.g.: if (int var = init());
+  if (!T->isAggregateType())
+    ConditionVar->setReferenced(/*R=*/false);
----------------
aaron.ballman wrote:
> `isAggregateType()` includes arrays and I think we still want to diagnose an 
> unused array.
Should it not be `Condition->hasSideEffects()` ? 
Hopefully we want to be consistent with existing behavior 
https://godbolt.org/z/6abbPhn4G


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152495/new/

https://reviews.llvm.org/D152495

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to