aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/InterpBuiltin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/ByteCode/InterpBuiltin.cpp')
-rw-r--r--clang/lib/AST/ByteCode/InterpBuiltin.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
index 71fd25c..285ea71 100644
--- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp
+++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp
@@ -1792,6 +1792,17 @@ static bool interp__builtin_memcpy(InterpState &S, CodePtr OpPC,
return false;
}
+ // Diagnose integral src/dest pointers specially.
+ if (SrcPtr.isIntegralPointer() || DestPtr.isIntegralPointer()) {
+ std::string DiagVal = "(void *)";
+ DiagVal += SrcPtr.isIntegralPointer()
+ ? std::to_string(SrcPtr.getIntegerRepresentation())
+ : std::to_string(DestPtr.getIntegerRepresentation());
+ S.FFDiag(S.Current->getSource(OpPC), diag::note_constexpr_memcpy_null)
+ << Move << false << DestPtr.isIntegralPointer() << DiagVal;
+ return false;
+ }
+
// Can't read from dummy pointers.
if (DestPtr.isDummy() || SrcPtr.isDummy())
return false;