diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 97eeba8b9d6cc..cb3a359a6df95 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -3611,7 +3611,7 @@ static bool evaluateVarDeclInit(EvalInfo &Info, const Expr *E, // Never use the initializer of a weak variable, not even for constant // folding. We can't be sure that this is the definition that will be used. - if (VD->isWeak()) { + if (VD->isWeak()&& (Info.EvalMode != EvaluationMode::ConstantExpression)) { Info.FFDiag(E, diag::note_constexpr_var_init_weak) << VD; NoteLValueLocation(Info, Base); return false;