Skip to content

Commit b1e9dbb

Browse files
author
git apple-llvm automerger
committed
Merge commit 'e35cb1a59b3e' from llvm.org/release/21.x into stable/21.x
2 parents 45b94fb + e35cb1a commit b1e9dbb

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8086,8 +8086,9 @@ static bool checkBitCastConstexprEligibilityType(SourceLocation Loc,
80868086
// so its layout is unspecified. For now, we'll simply treat these cases
80878087
// as unsupported (this should only be possible with OpenCL bool vectors
80888088
// whose element count isn't a multiple of the byte size).
8089-
Info->FFDiag(Loc, diag::note_constexpr_bit_cast_invalid_vector)
8090-
<< QualType(VTy, 0) << EltSize << NElts << Ctx.getCharWidth();
8089+
if (Info)
8090+
Info->FFDiag(Loc, diag::note_constexpr_bit_cast_invalid_vector)
8091+
<< QualType(VTy, 0) << EltSize << NElts << Ctx.getCharWidth();
80918092
return false;
80928093
}
80938094

@@ -8096,8 +8097,9 @@ static bool checkBitCastConstexprEligibilityType(SourceLocation Loc,
80968097
// The layout for x86_fp80 vectors seems to be handled very inconsistently
80978098
// by both clang and LLVM, so for now we won't allow bit_casts involving
80988099
// it in a constexpr context.
8099-
Info->FFDiag(Loc, diag::note_constexpr_bit_cast_unsupported_type)
8100-
<< EltTy;
8100+
if (Info)
8101+
Info->FFDiag(Loc, diag::note_constexpr_bit_cast_unsupported_type)
8102+
<< EltTy;
81018103
return false;
81028104
}
81038105
}

clang/test/Sema/constexpr.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,10 @@ void ghissue109095() {
391391
_Static_assert(i == c[0]); // expected-error {{static assertion expression is not an integral constant expression}}\
392392
// expected-note {{initializer of 'i' is not a constant expression}}
393393
}
394+
395+
typedef bool __vbool2 __attribute__((ext_vector_type(2)));
396+
typedef short v2int16_t __attribute__((ext_vector_type(2)));
397+
398+
bool issue155507(v2int16_t a, v2int16_t b) {
399+
return __builtin_bit_cast(unsigned char, __builtin_convertvector(a == b, __vbool2)) == 0b11;
400+
}

0 commit comments

Comments
 (0)