[clang] [Clang][C++23] update constexpr diagnostics for missing return statements per P2448 (PR #94123)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 4 09:36:07 PDT 2024
================
@@ -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'
----------------
AaronBallman wrote:
```suggestion
// C++14 doesn't require constexpr functions to contain a 'return'
```
https://github.com/llvm/llvm-project/pull/94123
More information about the cfe-commits
mailing list