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

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Mon May 25 19:59:54 PDT 2026


================
@@ -15603,3 +15581,17 @@ void ASTContext::recordOffsetOfEvaluation(const OffsetOfExpr *E) {
   if (FieldDecl *FD = Comp.getField(); isPFPField(FD))
     PFPFieldsWithEvaluatedOffset.insert(FD);
 }
+
+bool ASTContext::maybeFoldMSConstexpr(
+    APValue &Val, SmallVectorImpl<PartialDiagnosticAt> &Notes) {
+  if (Notes.size() != 1 || !getLangOpts().MSVCCompat || Val.isLValue())
----------------
efriedma-quic wrote:

`constexpr long x[2] = { (long)&x };`?

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


More information about the cfe-commits mailing list