diff options
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 87634ad57e5..956136859a0 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -8171,8 +8171,11 @@ struct IntRange { // For enum types, use the known bit width of the enumerators. if (const EnumType *ET = dyn_cast<EnumType>(T)) { EnumDecl *Enum = ET->getDecl(); + // In C++11, enums without definitions can have an explicitly specified + // underlying type. Use this type to compute the range. if (!Enum->isCompleteDefinition()) - return IntRange(C.getIntWidth(QualType(T, 0)), false); + return IntRange(C.getIntWidth(QualType(T, 0)), + !ET->isSignedIntegerOrEnumerationType()); unsigned NumPositive = Enum->getNumPositiveBits(); unsigned NumNegative = Enum->getNumNegativeBits(); |