diff options
Diffstat (limited to 'clang/lib/AST/ByteCode/Interp.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Interp.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp index db91e5e..5c8abff 100644 --- a/clang/lib/AST/ByteCode/Interp.cpp +++ b/clang/lib/AST/ByteCode/Interp.cpp @@ -857,23 +857,22 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) { return false; } - // Bail out if the function declaration itself is invalid. We will - // have produced a relevant diagnostic while parsing it, so just - // note the problematic sub-expression. - if (F->getDecl()->isInvalidDecl()) - return Invalid(S, OpPC); - if (S.checkingPotentialConstantExpression() && S.Current->getDepth() != 0) return false; - if (F->isConstexpr() && F->hasBody() && - (F->getDecl()->isConstexpr() || F->getDecl()->hasAttr<MSConstexprAttr>())) + if (F->isValid() && F->hasBody() && F->isConstexpr()) return true; // Implicitly constexpr. if (F->isLambdaStaticInvoker()) return true; + // Bail out if the function declaration itself is invalid. We will + // have produced a relevant diagnostic while parsing it, so just + // note the problematic sub-expression. + if (F->getDecl()->isInvalidDecl()) + return Invalid(S, OpPC); + // Diagnose failed assertions specially. if (S.Current->getLocation(OpPC).isMacroID() && F->getDecl()->getIdentifier()) { @@ -923,7 +922,8 @@ bool CheckCallable(InterpState &S, CodePtr OpPC, const Function *F) { // for a constant expression. It might be defined at the point we're // actually calling it. bool IsExtern = DiagDecl->getStorageClass() == SC_Extern; - if (!DiagDecl->isDefined() && !IsExtern && DiagDecl->isConstexpr() && + bool IsDefined = F->isDefined(); + if (!IsDefined && !IsExtern && DiagDecl->isConstexpr() && S.checkingPotentialConstantExpression()) return false; |