[clang] [Clang] Instantiate constexpr function when they are needed. (PR #173537)
Corentin Jabot via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 2 01:14:59 PST 2026
================
@@ -20707,6 +20739,8 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx,
: EvaluationMode::ConstantFold);
Info.setEvaluatingDecl(VD, Value);
Info.InConstantContext = IsConstantInitialization;
+ Info.TryConstantInitialization =
+ !VD->isConstexpr() && !VD->hasAttr<ConstInitAttr>();
----------------
cor3ntin wrote:
It's the other way around - when trying to initialize a constant-initialized non-constexpr variable we do **not** want to force an instantiation (it may not yet be available or a more specialized definition may be provided later)
https://github.com/llvm/llvm-project/pull/173537
More information about the cfe-commits
mailing list