aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Interp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/ByteCode/Interp.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Interp.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index d5e75a0..0f322f6 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -1750,9 +1750,8 @@ bool CallPtr(InterpState &S, CodePtr OpPC, uint32_t ArgSize,
const Pointer &Ptr = S.Stk.pop<Pointer>();
if (Ptr.isZero()) {
- const auto *E = cast<CallExpr>(S.Current->getExpr(OpPC));
- S.FFDiag(E, diag::note_constexpr_null_callee)
- << const_cast<Expr *>(E->getCallee()) << E->getSourceRange();
+ S.FFDiag(S.Current->getSource(OpPC), diag::note_constexpr_null_callee)
+ << const_cast<Expr *>(CE->getCallee()) << CE->getSourceRange();
return false;
}
@@ -1778,6 +1777,14 @@ bool CallPtr(InterpState &S, CodePtr OpPC, uint32_t ArgSize,
return false;
}
+ // Can happen when casting function pointers around.
+ QualType CalleeType = CE->getCallee()->getType();
+ if (CalleeType->isPointerType() &&
+ !S.getASTContext().hasSameFunctionTypeIgnoringExceptionSpec(
+ F->getDecl()->getType(), CalleeType->getPointeeType())) {
+ return false;
+ }
+
assert(ArgSize >= F->getWrittenArgSize());
uint32_t VarArgSize = ArgSize - F->getWrittenArgSize();