[clang] [clang] Allow C-style casts in constexpr in MS compatible mode (PR #197005)
via cfe-commits
cfe-commits at lists.llvm.org
Mon May 25 07:09:49 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())
----------------
eleviant wrote:
Under what circumstances can this happen. To my understanding if evaluator sees lvalue in sub expression then the result is either lvalue or None. The only exception, I've found is label subtraction, e.g `(intptr_t)&&a - (intptr_t)&&b`. I've added few examples demonstrating this behavior in latest commit.
https://github.com/llvm/llvm-project/pull/197005
More information about the cfe-commits
mailing list