aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/implicit-casts.c
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-08-25 14:37:06 +0000
committerSteve Naroff <snaroff@apple.com>2007-08-25 14:37:06 +0000
commitad7ef480b93a0d5dd23ec2202662b99465fcfa7e (patch)
treea69db8300c03fef6df3ef699f5b265331c829219 /test/Parser/implicit-casts.c
parent210679cacc47640107e46090de1a138977a0431e (diff)
Change Expr::isLvalue() to properly deal with ImplicitCastExpr's.
This fixes the following bug... t.c:1:31: error: expression is not assignable short x; void foo(char c) { x += c; } This case, among others are now captured in implicit-casts.c. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41402 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Parser/implicit-casts.c')
-rw-r--r--test/Parser/implicit-casts.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Parser/implicit-casts.c b/test/Parser/implicit-casts.c
new file mode 100644
index 0000000000..4ba56e4191
--- /dev/null
+++ b/test/Parser/implicit-casts.c
@@ -0,0 +1,20 @@
+// RUN: clang -parse-ast-check %s
+_Complex double X;
+void test1(int c) {
+ X = 5;
+}
+void test2() {
+ int i;
+ double d = i;
+ double _Complex a = 5;
+
+ test1(a);
+ a = 5;
+ d = i;
+}
+int test3() {
+ int a[2];
+ a[0] = test3; // expected-warning{{incompatible types assigning 'int (void)' to 'int'}}
+}
+short x; void test4(char c) { x += c; }
+int y; void test5(char c) { y += c; }