[clang] [Clang] Instantiate constexpr function when they are needed. (PR #173537)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 25 02:13:18 PST 2025
================
@@ -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>();
----------------
tbaederr wrote:
Doesn't this mean we only do it for initializers? What if I want to call such a function in a `static_assert` call? Shouldn't that work too?
https://github.com/llvm/llvm-project/pull/173537
More information about the cfe-commits
mailing list