diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-10-26 07:38:19 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-10-26 07:38:19 +0000 |
commit | 3bfb571bd4af9303781c40306a06bf70fe51fa75 (patch) | |
tree | 21f5fba495694d59435e0ec3d83ca6c3182914b0 /lib/Sema/SemaDecl.cpp | |
parent | 68a2dc446fe6d32d5da3557902100ed06b21b12b (diff) |
Compute the promoted integer type of fixed-width enums correctly. Found by inspection.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143021 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 2241024ba4..7ad8fb34b8 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -9702,7 +9702,11 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, Packed = true; if (Enum->isFixed()) { - BestType = BestPromotionType = Enum->getIntegerType(); + BestType = Enum->getIntegerType(); + if (BestType->isPromotableIntegerType()) + BestPromotionType = Context.getPromotedIntegerType(BestType); + else + BestPromotionType = BestType; // We don't need to set BestWidth, because BestType is going to be the type // of the enumerators, but we do anyway because otherwise some compilers // warn that it might be used uninitialized. |