aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/AST/ExprConstant.cpp3
-rw-r--r--test/Sema/enum.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 9eeaa868a5..341baeab85 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -430,6 +430,9 @@ bool IntExprEvaluator::VisitDeclRefExpr(const DeclRefExpr *E) {
// Enums are integer constant exprs.
if (const EnumConstantDecl *D = dyn_cast<EnumConstantDecl>(E->getDecl())) {
Result = D->getInitVal();
+ // FIXME: This is an ugly hack around the fact that enums don't set their
+ // signedness consistently; see PR3173
+ Result.setIsUnsigned(!E->getType()->isSignedIntegerType());
return true;
}
diff --git a/test/Sema/enum.c b/test/Sema/enum.c
index b06882b4d3..5782a43242 100644
--- a/test/Sema/enum.c
+++ b/test/Sema/enum.c
@@ -55,3 +55,6 @@ enum someenum {}; // expected-warning {{use of empty enum extension}}
enum e0 { // expected-note {{previous definition is here}}
E0 = sizeof(enum e0 { E1 }) // expected-error {{nested redefinition}}
};
+
+// PR3173
+enum { PR3173A, PR3173B = PR3173A+50 };