diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/Sema.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 5c92b65f82..f6f572feec 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -424,9 +424,15 @@ static bool IsSameIntAfterCast(const APValue &value, unsigned TargetWidth) { return true; } - assert(value.isComplexInt()); - return IsSameIntAfterCast(value.getComplexIntReal(), TargetWidth) && - IsSameIntAfterCast(value.getComplexIntImag(), TargetWidth); + if (value.isComplexInt()) { + return IsSameIntAfterCast(value.getComplexIntReal(), TargetWidth) && + IsSameIntAfterCast(value.getComplexIntImag(), TargetWidth); + } + + // This can happen with lossless casts to intptr_t of "based" lvalues. + // Assume it might use arbitrary bits. + assert(value.isLValue()); + return false; } |