Skip to content

Commit 7802fb5

Browse files
authored
[clang][bytecode] Fix __extension__ handling for vector operators (#118482)
Don't reject them, but delegate to the subexpression.
1 parent e1cb316 commit 7802fb5

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5914,6 +5914,9 @@ bool Compiler<Emitter>::VisitVectorUnaryOperator(const UnaryOperator *E) {
59145914
return this->discard(SubExpr);
59155915

59165916
auto UnaryOp = E->getOpcode();
5917+
if (UnaryOp == UO_Extension)
5918+
return this->delegate(SubExpr);
5919+
59175920
if (UnaryOp != UO_Plus && UnaryOp != UO_Minus && UnaryOp != UO_LNot &&
59185921
UnaryOp != UO_Not && UnaryOp != UO_AddrOf)
59195922
return this->emitInvalid(E);

clang/test/AST/ByteCode/vectors.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static_assert(arr4[1][0] == 0, "");
3737
static_assert(arr4[1][0] == 0, "");
3838
static_assert(arr4[1][0] == 0, "");
3939

40+
constexpr VI4 B = __extension__(A);
4041

4142
/// From constant-expression-cxx11.cpp
4243
namespace Vector {

0 commit comments

Comments
 (0)