================ @@ -2487,6 +2477,26 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl, return true; } +static bool CheckConstexprMissingReturn(Sema &SemaRef, + const FunctionDecl *Dcl) { + bool IsVoidOrDependentType = Dcl->getReturnType()->isVoidType() || + Dcl->getReturnType()->isDependentType(); + + if (SemaRef.getLangOpts().CPlusPlus23 && !IsVoidOrDependentType) + return true; + + // C++1y doesn't require constexpr functions to contain a 'return' + // statement. We still do, unless the return type might be void, because + // otherwise if there's no return statement, the function cannot + // be used in a core constant expression. ---------------- a-tarasyuk wrote:
@Fznamznon Thanks for the review. I've added a comment. https://github.com/llvm/llvm-project/pull/94123 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits