diff options
author | James Y Knight <jyknight@google.com> | 2018-10-05 17:49:48 +0000 |
---|---|---|
committer | James Y Knight <jyknight@google.com> | 2018-10-05 17:49:48 +0000 |
commit | c7d3e609fbf05d1a1236f99efd1e2fd344554f4b (patch) | |
tree | b680e18f7b0d4cebb19eb9164c38022269724a7e /clang/lib/AST/ExprConstant.cpp | |
parent | f194033316256a590a2ebebdf1b336a0ee466e54 (diff) | |
download | bcm5719-llvm-c7d3e609fbf05d1a1236f99efd1e2fd344554f4b.tar.gz bcm5719-llvm-c7d3e609fbf05d1a1236f99efd1e2fd344554f4b.zip |
Emit diagnostic note when calling an invalid function declaration.
The comment said it was intentionally not emitting any diagnostic
because the declaration itself was already diagnosed. However,
everywhere else that wants to not emit a diagnostic without an extra
note emits note_invalid_subexpr_in_const_expr instead, which gets
suppressed later.
This was the only place which did not emit a diagnostic note.
Differential Revision: https://reviews.llvm.org/D52919
llvm-svn: 343867
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index c012fc377fb..8a2cbdc1871 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -4330,10 +4330,13 @@ static bool CheckConstexprFunction(EvalInfo &Info, SourceLocation CallLoc, Declaration->isConstexpr()) return false; - // Bail out with no diagnostic if the function declaration itself is invalid. - // We will have produced a relevant diagnostic while parsing it. - if (Declaration->isInvalidDecl()) + // 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 (Declaration->isInvalidDecl()) { + Info.FFDiag(CallLoc, diag::note_invalid_subexpr_in_const_expr); return false; + } // Can we evaluate this function call? if (Definition && Definition->isConstexpr() && |