summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-10-26 07:38:19 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-10-26 07:38:19 +0000
commit64d9504b8f155c392e63e9a0ce17ca906385b9c1 (patch)
treee8ca40aebe6745b29a2f3ff250bd45b0a34608ae /clang/lib/Sema/SemaDecl.cpp
parent8fae82a196f266f47d4f77832c83cf26788c59c4 (diff)
downloadbcm5719-llvm-64d9504b8f155c392e63e9a0ce17ca906385b9c1.tar.gz
bcm5719-llvm-64d9504b8f155c392e63e9a0ce17ca906385b9c1.zip
Compute the promoted integer type of fixed-width enums correctly. Found by inspection.
llvm-svn: 143021
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 2241024ba4d..7ad8fb34b8b 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud