[clang] Disable constexpr function body checking in more situations (PR #94347)
Mariya Podchishchaeva via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 4 06:34:34 PDT 2024
================
@@ -2469,11 +2469,20 @@ static bool CheckConstexprFunctionBody(Sema &SemaRef, const FunctionDecl *Dcl,
// base class sub-objects shall be a constexpr constructor.
//
// Note that this rule is distinct from the "requirements for a constexpr
- // function", so is not checked in CheckValid mode.
+ // function", so is not checked in CheckValid mode. Because the check for
+ // constexpr potential is expensive, skip the check if the diagnostic is
+ // disabled, the function is declared in a system header, or we're in C++23
+ // or later mode (see https://wg21.link/P2448).
+ auto SkipCheck = [&SemaRef, Dcl] {
----------------
Fznamznon wrote:
Is that not to check all this when `Kind != Sema::CheckConstexprKind::Diagnose`? I was under impression that `Expr::isPotentialConstantExpr` is the expensive call.
https://github.com/llvm/llvm-project/pull/94347
More information about the cfe-commits
mailing list