@@ -5968,8 +5968,9 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc,
59685968
59695969 // Can we evaluate this function call?
59705970 if (Definition && Body &&
5971- (Definition->isConstexpr() || (Info.CurrentCall->CanEvalMSConstexpr &&
5972- Definition->hasAttr<MSConstexprAttr>())))
5971+ (Definition->isConstexprOrImplicitlyCanBe(Info.Ctx.getLangOpts()) ||
5972+ (Info.CurrentCall->CanEvalMSConstexpr &&
5973+ Definition->hasAttr<MSConstexprAttr>())))
59735974 return true;
59745975
59755976 if (Info.getLangOpts().CPlusPlus11) {
@@ -5987,12 +5988,25 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc,
59875988 // FIXME: If DiagDecl is an implicitly-declared special member function
59885989 // or an inheriting constructor, we should be much more explicit about why
59895990 // it's not constexpr.
5990- if (CD && CD->isInheritingConstructor())
5991+ if (CD && CD->isInheritingConstructor()) {
59915992 Info.FFDiag(CallLoc, diag::note_constexpr_invalid_inhctor, 1)
59925993 << CD->getInheritedConstructor().getConstructor()->getParent();
5993- else
5994+
5995+ } else if (Definition && !DiagDecl->isInlined() &&
5996+ Info.Ctx.getLangOpts().ImplicitConstexpr) {
5997+ Info.FFDiag(CallLoc,
5998+ diag::note_constexpr_implicit_constexpr_must_be_inlined)
5999+ << DiagDecl;
6000+
6001+ } else {
6002+ // Using implicit constexpr check here, so we see a missing body as main
6003+ // problem and not missing constexpr with -fimplicit-constexpr.
59946004 Info.FFDiag(CallLoc, diag::note_constexpr_invalid_function, 1)
5995- << DiagDecl->isConstexpr() << (bool)CD << DiagDecl;
6005+ << DiagDecl->isConstexprOrImplicitlyCanBe(Info.Ctx.getLangOpts(),
6006+ false)
6007+ << (bool)CD << DiagDecl;
6008+ }
6009+
59966010 Info.Note(DiagDecl->getLocation(), diag::note_declared_at);
59976011 } else {
59986012 Info.FFDiag(CallLoc, diag::note_invalid_subexpr_in_const_expr);
0 commit comments