[analyzer] Test case: p->x is the same as p[0].x. (PR7297)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156720 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Analysis/array-struct-region.c b/test/Analysis/array-struct-region.c
index 4b085c8..8be8688 100644
--- a/test/Analysis/array-struct-region.c
+++ b/test/Analysis/array-struct-region.c
@@ -45,3 +45,16 @@
       vec[a][1] *= rad; // no-warning
   }
 }
+
+
+void struct_as_array() {
+  struct simple { int x; };
+  struct simple a;
+  struct simple *p = &a;
+  p->x = 5;
+  if (!p[0].x)
+    return; // expected-warning{{never executed}}
+  if (p[0].x)
+    return; // no-warning
+}
+