Skip to content

Commit 69cd2d2

Browse files
committed
[clang][Interp] Handle __extension__ for complex values
1 parent cb8e936 commit 69cd2d2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

clang/lib/AST/Interp/ByteCodeExprGen.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3839,6 +3839,9 @@ bool ByteCodeExprGen<Emitter>::VisitComplexUnaryOperator(
38393839
return false;
38403840
return DiscardResult ? this->emitPopPtr(E) : true;
38413841

3842+
case UO_Extension:
3843+
return this->delegate(SubExpr);
3844+
38423845
default:
38433846
return this->emitInvalid(E);
38443847
}

clang/test/AST/Interp/complex.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ static_assert(__imag(Doubles[3]) == 0.0, "");
117117

118118
static_assert(~(0.5 + 1.5j) == (0.5 + -1.5j), "");
119119

120+
static_assert(__extension__ __imag(A) == 0, "");
121+
static_assert(__imag(__extension__ A) == 0, "");
122+
120123
void func(void) {
121124
__complex__ int arr;
122125
_Complex int result;

0 commit comments

Comments
 (0)