[clang] [C++26][clang] Implement P2795R5 'Erroneous behaviour for uninitialized reads' (PR #177614)

via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 01:51:38 PDT 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions h,cpp -- clang/test/CodeGenCXX/cxx26-indeterminate-attribute.cpp clang/test/SemaCXX/cxx26-erroneous-behavior-warning.cpp clang/test/SemaCXX/cxx26-erroneous-constexpr.cpp clang/test/SemaCXX/cxx26-indeterminate-attribute.cpp clang/include/clang/AST/APValue.h clang/lib/AST/APValue.cpp clang/lib/AST/ASTImporter.cpp clang/lib/AST/Expr.cpp clang/lib/AST/ExprConstant.cpp clang/lib/AST/ItaniumMangle.cpp clang/lib/AST/MicrosoftMangle.cpp clang/lib/AST/TextNodeDumper.cpp clang/lib/CIR/CodeGen/CIRGenExprConstant.cpp clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CGExprConstant.cpp clang/lib/CodeGen/CodeGenFunction.h clang/lib/Sema/AnalysisBasedWarnings.cpp clang/lib/Sema/SemaDecl.cpp clang/lib/Sema/SemaDeclAttr.cpp clang/lib/Sema/SemaTemplate.cpp clang/test/CXX/drs/cwg1736.cpp clang/test/SemaCXX/cxx2c-constexpr-placement-new.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 1fc9fd703..1ef71cc56 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -4185,7 +4185,7 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
       if (!Info.checkingPotentialConstantExpression()) {
         Info.FFDiag(E, diag::note_constexpr_access_uninit)
             << handler.AccessKind << O->isUninit() << E->getSourceRange();
-      return handler.failed();
+        return handler.failed();
     }
 
     // C++ [class.ctor]p5, C++ [class.dtor]p5:
@@ -4387,7 +4387,7 @@ findSubobject(EvalInfo &Info, const Expr *E, const CompleteObject &Obj,
 
       ObjType = getSubobjectType(ObjType, Info.Ctx.getCanonicalTagType(Base));
     }
-  }
+    }
 }
 
 namespace {

``````````

</details>


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


More information about the cfe-commits mailing list