[clang] [libcxx] [clang] Fix -Wuninitialized for values passed by const pointers (PR #147221)

Igor Kudrin via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 7 15:02:33 PDT 2025


================
@@ -453,7 +450,7 @@ void ClassifyRefs::VisitCallExpr(CallExpr *CE) {
       const auto *UO = dyn_cast<UnaryOperator>(Ex);
       if (UO && UO->getOpcode() == UO_AddrOf)
         Ex = UO->getSubExpr();
-      classify(Ex, Ignore);
+      classify(Ex, Use);
----------------
igorkudrin wrote:

> Correct. We intentionally don't warn on that -- a "const reference use" is neither treated as initializing nor as using the local variable.

What is the basis of this intention?

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


More information about the cfe-commits mailing list