Add an any_cast test for array types. Thanks to Jonathan Wakely for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@359085 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/std/utilities/any/any.class/any.observers/type.pass.cpp b/test/std/utilities/any/any.class/any.observers/type.pass.cpp
index bb9089c..bf7ea92 100644
--- a/test/std/utilities/any/any.class/any.observers/type.pass.cpp
+++ b/test/std/utilities/any/any.class/any.observers/type.pass.cpp
@@ -16,6 +16,8 @@
 
 #include <any>
 #include <cassert>
+
+#include "test_macros.h"
 #include "any_helpers.h"
 
 int main(int, char**)
@@ -24,19 +26,23 @@
     {
         any const a;
         assert(a.type() == typeid(void));
-        static_assert(noexcept(a.type()), "any::type() must be noexcept");
+        ASSERT_NOEXCEPT(a.type());
     }
     {
         small const s(1);
         any const a(s);
         assert(a.type() == typeid(small));
-
     }
     {
         large const l(1);
         any const a(l);
         assert(a.type() == typeid(large));
     }
+    {
+        int arr[3];
+        any const a(arr);
+        assert(a.type() == typeid(int*));  // ensure that it is decayed
+    }
 
   return 0;
 }
diff --git a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
index 58f58af..d2cf586 100644
--- a/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
+++ b/test/std/utilities/any/any.nonmembers/any.cast/any_cast_pointer.pass.cpp
@@ -22,6 +22,7 @@
 #include <type_traits>
 #include <cassert>
 
+#include "test_macros.h"
 #include "any_helpers.h"
 
 using std::any;
@@ -30,21 +31,21 @@
 // Test that the operators are properly noexcept.
 void test_cast_is_noexcept() {
     any a;
-    static_assert(noexcept(any_cast<int>(&a)), "");
+    ASSERT_NOEXCEPT(any_cast<int>(&a));
 
     any const& ca = a;
-    static_assert(noexcept(any_cast<int>(&ca)), "");
+    ASSERT_NOEXCEPT(any_cast<int>(&ca));
 }
 
 // Test that the return type of any_cast is correct.
 void test_cast_return_type() {
     any a;
-    static_assert(std::is_same<decltype(any_cast<int>(&a)), int*>::value, "");
-    static_assert(std::is_same<decltype(any_cast<int const>(&a)), int const*>::value, "");
+    ASSERT_SAME_TYPE(decltype(any_cast<int>(&a)),       int*);
+    ASSERT_SAME_TYPE(decltype(any_cast<int const>(&a)), int const*);
 
     any const& ca = a;
-    static_assert(std::is_same<decltype(any_cast<int>(&ca)), int const*>::value, "");
-    static_assert(std::is_same<decltype(any_cast<int const>(&ca)), int const*>::value, "");
+    ASSERT_SAME_TYPE(decltype(any_cast<int>(&ca)),       int const*);
+    ASSERT_SAME_TYPE(decltype(any_cast<int const>(&ca)), int const*);
 }
 
 // Test that any_cast handles null pointers.
@@ -148,6 +149,15 @@
     assert(std::any_cast<NoCopy>(&ca) == nullptr);
 }
 
+void test_cast_array() {
+    int arr[3];
+    std::any a(arr);
+    assert(a.type() == typeid(int*)); // contained value is decayed
+//  We can't get an array out
+    int (*p)[3] = std::any_cast<int[3]>(&a);
+    assert(p == nullptr);
+}
+
 void test_fn() {}
 
 void test_cast_function_pointer() {
@@ -168,6 +178,7 @@
     test_cast<small>();
     test_cast<large>();
     test_cast_non_copyable_type();
+    test_cast_array();
     test_cast_function_pointer();
 
   return 0;