Skip to content

Commit 5f2f390

Browse files
committed
[clang][Interp][NFC] Allow Pointer assignment if both are zero
... even if the storage types are different.
1 parent 05f4448 commit 5f2f390

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang/lib/AST/Interp/Pointer.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,8 @@ Pointer::~Pointer() {
6363
}
6464

6565
void Pointer::operator=(const Pointer &P) {
66-
6766
if (!this->isIntegralPointer() || !P.isBlockPointer())
68-
assert(P.StorageKind == StorageKind);
67+
assert(P.StorageKind == StorageKind || (this->isZero() && P.isZero()));
6968

7069
bool WasBlockPointer = isBlockPointer();
7170
StorageKind = P.StorageKind;
@@ -92,7 +91,7 @@ void Pointer::operator=(const Pointer &P) {
9291

9392
void Pointer::operator=(Pointer &&P) {
9493
if (!this->isIntegralPointer() || !P.isBlockPointer())
95-
assert(P.StorageKind == StorageKind);
94+
assert(P.StorageKind == StorageKind || (this->isZero() && P.isZero()));
9695

9796
bool WasBlockPointer = isBlockPointer();
9897
StorageKind = P.StorageKind;

0 commit comments

Comments
 (0)