Skip to content

Commit bfae734

Browse files
authored
Merge pull request #78009 from 2horse9sun/fix-JSONSerialization-ScalarBitSetTraits-map-enum
Fix compile error caused by customized mapping of enums during JSONSerialization
2 parents 59f80bf + 6a014e7 commit bfae734

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/swift/Basic/JSONSerialization.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,21 +443,21 @@ class Output {
443443
template <typename T>
444444
void bitSetCase(T &Val, const char* Str, const T ConstVal) {
445445
if (bitSetMatch(Str, (Val & ConstVal) == ConstVal)) {
446-
Val = Val | ConstVal;
446+
Val = static_cast<T>(Val | ConstVal);
447447
}
448448
}
449449

450450
template <typename T>
451451
void maskedBitSetCase(T &Val, const char *Str, T ConstVal, T Mask) {
452452
if (bitSetMatch(Str, (Val & Mask) == ConstVal))
453-
Val = Val | ConstVal;
453+
Val = static_cast<T>(Val | ConstVal);
454454
}
455455

456456
template <typename T>
457457
void maskedBitSetCase(T &Val, const char *Str, uint32_t ConstVal,
458458
uint32_t Mask) {
459459
if (bitSetMatch(Str, (Val & Mask) == ConstVal))
460-
Val = Val | ConstVal;
460+
Val = static_cast<T>(Val | ConstVal);
461461
}
462462

463463
template <typename T>

0 commit comments

Comments
 (0)