aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-01-23 21:04:18 +0000
committerDouglas Gregor <dgregor@apple.com>2009-01-23 21:04:18 +0000
commit53d3d8e0662197f7245d8f5ff697a72a2b4b3f54 (patch)
tree957cad60b6508ce196facdfb34523acecca949dd
parent491918ee2fdd7193fad36b0a539151e5eb3fc332 (diff)
Hopefully the last of the APSInt signedness issues with initializers. Fixes PR clang/3378
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62876 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaInit.cpp1
-rw-r--r--test/Sema/designated-initializers.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index aff46ef61d..15e2d5d13f 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -626,6 +626,7 @@ CheckArrayDesignatorExpr(Sema &Self, Expr *Index, llvm::APSInt &Value) {
return Self.Diag(Loc, diag::err_array_designator_negative)
<< Value.toString(10) << Index->getSourceRange();
+ Value.setIsUnsigned(true);
return false;
}
diff --git a/test/Sema/designated-initializers.c b/test/Sema/designated-initializers.c
index 3fe5f8484c..8f7eb8cda9 100644
--- a/test/Sema/designated-initializers.c
+++ b/test/Sema/designated-initializers.c
@@ -113,6 +113,7 @@ struct disklabel_ops disklabel64_ops = {
.labelsize = sizeof(struct disklabel_ops)
};
-// PR clang/3377
+// PR clang/3378
int bitwidth[] = { [(long long int)1] = 5, [(short int)2] = 2 };
int a[]= { [sizeof(int)] = 0 };
+int a2[]= { [0 ... sizeof(int)] = 0 };