Let -Warray-bounds handle casted array types without false positives.

Fixes PR10771.

llvm-svn: 139990
diff --git a/clang/test/SemaCXX/array-bounds.cpp b/clang/test/SemaCXX/array-bounds.cpp
index 2bbb477..e071bc7 100644
--- a/clang/test/SemaCXX/array-bounds.cpp
+++ b/clang/test/SemaCXX/array-bounds.cpp
@@ -214,3 +214,15 @@
   else
     return foo[5]; // expected-warning {{array index of '5' indexes past the end of an array (that contains 5 elements)}}
 }
+
+void test_pr10771() {
+    double foo[4096];  // expected-note {{array 'foo' declared here}}
+
+    ((char*)foo)[sizeof(foo) - 1] = '\0';  // no-warning
+    *(((char*)foo) + sizeof(foo) - 1) = '\0';  // no-warning
+
+    ((char*)foo)[sizeof(foo)] = '\0';  // expected-warning {{array index of '32768' indexes past the end of an array (that contains 32768 elements)}}
+
+    // TODO: This should probably warn, too.
+    *(((char*)foo) + sizeof(foo)) = '\0';  // no-warning
+}