aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaDecl.cpp2
-rw-r--r--test/Sema/enum.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 3821113439..e7217dc220 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -5732,7 +5732,7 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum,
if (!isRepresentableIntegerValue(Context, EnumVal, Context.IntTy))
Diag(IdLoc, diag::ext_enum_value_not_int)
<< EnumVal.toString(10) << Val->getSourceRange()
- << EnumVal.isNonNegative();
+ << (EnumVal.isUnsigned() || EnumVal.isNonNegative());
else if (!Context.hasSameType(Val->getType(), Context.IntTy)) {
// Force the type of the expression to 'int'.
ImpCastExprToType(Val, Context.IntTy, CastExpr::CK_IntegralCast);
diff --git a/test/Sema/enum.c b/test/Sema/enum.c
index 9b4650091e..6177edff91 100644
--- a/test/Sema/enum.c
+++ b/test/Sema/enum.c
@@ -9,7 +9,8 @@ enum g { // too negative
c = -2147483649, // expected-warning {{ISO C restricts enumerator values to range of 'int'}}
d = 2147483647 };
enum h { e = -2147483648, // too pos
- f = 2147483648 // expected-warning {{ISO C restricts enumerator values to range of 'int'}}
+ f = 2147483648, // expected-warning {{ISO C restricts enumerator values to range of 'int'}}
+ i = 0xFFFF0000 // expected-warning {{too large}}
};
// minll maxull