aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2010-01-03 00:20:48 +0000
committerEli Friedman <eli.friedman@gmail.com>2010-01-03 00:20:48 +0000
commit5b088a10e106a287684bef78cd6c3a3830ac0721 (patch)
tree1ecb6959008946914319588441509ccb79eb7f95
parent8ac5549e726f67c2d37647ecad6d543e71f82950 (diff)
Fix minor oversight for increment/decrement of complex int. Add tests for
coverage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92433 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--test/CodeGen/complex.c32
-rw-r--r--test/Sema/complex-int.c4
3 files changed, 36 insertions, 2 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 7bf04d88cd..feb6b2b666 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -5776,7 +5776,7 @@ QualType Sema::CheckIncrementDecrementOperand(Expr *Op, SourceLocation OpLoc,
<< PointeeTy << Op->getSourceRange();
return QualType();
}
- } else if (ResType->isComplexType()) {
+ } else if (ResType->isAnyComplexType()) {
// C99 does not support ++/-- on complex types, we allow as an extension.
Diag(OpLoc, diag::ext_integer_increment_complex)
<< ResType << Op->getSourceRange();
diff --git a/test/CodeGen/complex.c b/test/CodeGen/complex.c
index 8d9c68d074..ca606109f8 100644
--- a/test/CodeGen/complex.c
+++ b/test/CodeGen/complex.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm < %s
+// RUN: %clang_cc1 -emit-llvm-only %s
int main(void)
{
@@ -39,6 +39,25 @@ void test3() {
g1 = D + g1;
}
+__complex__ int ci1, ci2;
+__complex__ short cs;
+int i;
+void test3int() {
+ ci1 = ci1 + ci2;
+ ci1 = ci1 - ci2;
+ ci1 = ci1 * ci2;
+ ci1 = +-~ci1;
+
+ i = __real ci1;
+
+ cs += i;
+ // FIXME: Currently unsupported!
+ //D += cf;
+ cs /= ci1;
+ ci1 = ci1 + i;
+ ci1 = i + ci1;
+}
+
void t1() {
(__real__ cf) = 4.0;
}
@@ -59,3 +78,14 @@ void t5() {
float _Complex x = t4();
}
+void t6() {
+ g1++;
+ g1--;
+ ++g1;
+ --g1;
+ ci1++;
+ ci1--;
+ ++ci1;
+ --ci1;
+}
+
diff --git a/test/Sema/complex-int.c b/test/Sema/complex-int.c
index 2bd03744d7..cb76a342c2 100644
--- a/test/Sema/complex-int.c
+++ b/test/Sema/complex-int.c
@@ -49,3 +49,7 @@ void test3(_Complex int *x) {
void test4(_Complex float *x) {
*x = ~*x;
}
+
+void test5(_Complex int *x) {
+ (*x)++;
+}