[clang] [clang] Allow C-style casts in constexpr in MS compatible mode (PR #197005)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 30 07:40:43 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/SemaCXX/microsoft-constexpr-SFINAE.cpp clang/test/SemaCXX/microsoft-constexpr-SFINAE2.cpp clang/test/SemaCXX/microsoft-constexpr.cpp clang/test/SemaCXX/microsoft-constexpr2.cpp clang/test/SemaCXX/microsoft-constexpr3.cpp clang/include/clang/AST/Expr.h clang/lib/AST/ByteCode/State.cpp clang/lib/AST/ByteCode/State.h clang/lib/AST/ExprConstant.cpp clang/lib/Sema/SemaExpr.cpp clang/lib/Sema/SemaOverload.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/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 102dcbc7d..44a0c1e0e 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -622,11 +622,11 @@ public:
     /// Whether any diagnostic has been emitted. This is set regardless of
     /// whether @ref #Diag is set or not.
     bool DiagEmitted = false;
-    
+
     /// Whether part of expression is an LValue.
     /// Used when evaluating constant expression with Microsoft extensions.
     bool HasLValue = false;
-    
+
     /// Whether we've seen a ptr to int cast or null subobject while evaluating
     /// constant expression in MS compatibility mode.
     bool SeenCastOrNull = false;

``````````

</details>


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


More information about the cfe-commits mailing list