diff --git a/clang/AST/Expr.cpp b/clang/AST/Expr.cpp index 535e1ef786f1..5167d4e109b3 100644 --- a/clang/AST/Expr.cpp +++ b/clang/AST/Expr.cpp @@ -302,6 +302,8 @@ Expr::isLvalueResult Expr::isLvalue() const { if (cast(this)->containsDuplicateElements()) return LV_DuplicateVectorComponents; return LV_Valid; + case ImplicitCastExprClass: // A side-effect of our implementation. + return cast(this)->getSubExpr()->isLvalue(); default: break; } diff --git a/clang/test/Parser/implicit-casts.c b/clang/test/Parser/implicit-casts.c new file mode 100644 index 000000000000..4ba56e419126 --- /dev/null +++ b/clang/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; }