Skip to content

Commit 6099dfb

Browse files
committed
Merge pull request #2679 from rudkx/static_assert-fixes
Fix a static_assert, add a new one, and improve one other.
2 parents da46c1b + 340e044 commit 6099dfb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

include/swift/AST/Expr.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class alignas(8) Expr {
149149
unsigned IsSingleUnicodeScalar : 1;
150150
unsigned IsSingleExtendedGraphemeCluster : 1;
151151
};
152-
enum { NumStringLiteralExprBits = NumLiteralExprBits + 2 };
152+
enum { NumStringLiteralExprBits = NumLiteralExprBits + 4 };
153153
static_assert(NumStringLiteralExprBits <= 32, "fits in an unsigned");
154154

155155
class DeclRefExprBitfields {
@@ -271,6 +271,7 @@ class alignas(8) Expr {
271271
unsigned IsSourceScalar : 1;
272272
};
273273
enum { NumTupleShuffleExprBits = NumImplicitConversionExprBits + 1 };
274+
static_assert(NumTupleShuffleExprBits <= 32, "fits in an unsigned");
274275

275276
class ApplyExprBitfields {
276277
friend class ApplyExpr;
@@ -287,7 +288,7 @@ class alignas(8) Expr {
287288
unsigned : NumExprBits;
288289
unsigned CastKind : NumCheckedCastKindBits;
289290
};
290-
enum { NumCheckedCastExprBits = NumExprBits + 4 };
291+
enum { NumCheckedCastExprBits = NumExprBits + NumCheckedCastKindBits };
291292
static_assert(NumCheckedCastExprBits <= 32, "fits in an unsigned");
292293
static_assert(unsigned(CheckedCastKind::Last_CheckedCastKind)
293294
< (1 << NumCheckedCastKindBits),

0 commit comments

Comments
 (0)