Make std::get constexpr

llvm-svn: 186525
diff --git a/libcxx/test/containers/sequences/array/array.size/size.pass.cpp b/libcxx/test/containers/sequences/array/array.size/size.pass.cpp
index 4078fd5..fe5a0d5 100644
--- a/libcxx/test/containers/sequences/array/array.size/size.pass.cpp
+++ b/libcxx/test/containers/sequences/array/array.size/size.pass.cpp
@@ -21,12 +21,16 @@
         typedef std::array<T, 3> C;
         C c = {1, 2, 3.5};
         assert(c.size() == 3);
+        assert(c.max_size() == 3);
+        assert(!c.empty());
     }
     {
         typedef double T;
         typedef std::array<T, 0> C;
         C c = {};
         assert(c.size() == 0);
+        assert(c.max_size() == 0);
+        assert(c.empty());
     }
 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
     {
@@ -34,12 +38,16 @@
         typedef std::array<T, 3> C;
         constexpr C c = {1, 2, 3.5};
         static_assert(c.size() == 3, "");
+        static_assert(c.max_size() == 3, "");
+        static_assert(!c.empty(), "");
     }
     {
         typedef double T;
         typedef std::array<T, 0> C;
         constexpr C c = {};
         static_assert(c.size() == 0, "");
+        static_assert(c.max_size() == 0, "");
+        static_assert(c.empty(), "");
     }
 #endif
 }
diff --git a/libcxx/test/containers/sequences/array/array.tuple/get.pass.cpp b/libcxx/test/containers/sequences/array/array.tuple/get.pass.cpp
index 9820bab..d9e242c 100644
--- a/libcxx/test/containers/sequences/array/array.tuple/get.pass.cpp
+++ b/libcxx/test/containers/sequences/array/array.tuple/get.pass.cpp
@@ -14,6 +14,16 @@
 #include <array>
 #include <cassert>
 
+#if __cplusplus > 201103L
+struct S {
+   std::array<int, 3> a;
+   int k;
+   constexpr S() : a{1,2,3}, k(std::get<2>(a)) {}
+   };
+
+constexpr std::array<int, 2> getArr () { return { 3, 4 }; }
+#endif
+
 int main()
 {
     {
@@ -25,4 +35,18 @@
         assert(c[1] == 5.5);
         assert(c[2] == 3.5);
     }
+#if _LIBCPP_STD_VER > 11
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr C c = {1, 2, 3.5};
+        static_assert(std::get<0>(c) == 1, "");
+        static_assert(std::get<1>(c) == 2, "");
+        static_assert(std::get<2>(c) == 3.5, "");
+    }
+    {
+        static_assert(S().k == 3, "");
+        static_assert(std::get<1>(getArr()) == 4, "");
+    }
+#endif
 }
diff --git a/libcxx/test/containers/sequences/array/array.tuple/get_const.pass.cpp b/libcxx/test/containers/sequences/array/array.tuple/get_const.pass.cpp
index 6ede8f0..1cbdfa4 100644
--- a/libcxx/test/containers/sequences/array/array.tuple/get_const.pass.cpp
+++ b/libcxx/test/containers/sequences/array/array.tuple/get_const.pass.cpp
@@ -24,4 +24,14 @@
         assert(std::get<1>(c) == 2);
         assert(std::get<2>(c) == 3.5);
     }
+#if _LIBCPP_STD_VER > 11
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr const C c = {1, 2, 3.5};
+        static_assert(std::get<0>(c) == 1, "");
+        static_assert(std::get<1>(c) == 2, "");
+        static_assert(std::get<2>(c) == 3.5, "");
+    }
+#endif
 }
diff --git a/libcxx/test/containers/sequences/array/at.pass.cpp b/libcxx/test/containers/sequences/array/at.pass.cpp
new file mode 100644
index 0000000..b5cf8a5
--- /dev/null
+++ b/libcxx/test/containers/sequences/array/at.pass.cpp
@@ -0,0 +1,67 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// reference operator[] (size_type)
+// const_reference operator[] (size_type); // constexpr in C++14
+// reference at (size_type)
+// const_reference at (size_type); // constexpr in C++14
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        C::reference r1 = c.at(0);
+        assert(r1 == 1);
+        r1 = 5.5;
+        assert(c.front() == 5.5);
+        
+        C::reference r2 = c.at(2);
+        assert(r2 == 3.5);
+        r2 = 7.5;
+        assert(c.back() == 7.5);
+
+        try { (void) c.at(3); }
+        catch (const std::out_of_range &) {}
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        const C c = {1, 2, 3.5};
+        C::const_reference r1 = c.at(0);
+        assert(r1 == 1);
+        
+        C::const_reference r2 = c.at(2);
+        assert(r2 == 3.5);
+
+        try { (void) c.at(3); }
+        catch (const std::out_of_range &) {}
+    }
+    
+#if _LIBCPP_STD_VER > 11 
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr C c = {1, 2, 3.5};
+
+        constexpr T t1 = c.at(0);
+        static_assert (t1 == 1, "");
+
+        constexpr T t2 = c.at(2);
+        static_assert (t2 == 3.5, "");
+    }
+#endif
+
+}
diff --git a/libcxx/test/containers/sequences/array/front_back.pass.cpp b/libcxx/test/containers/sequences/array/front_back.pass.cpp
new file mode 100644
index 0000000..45a963b
--- /dev/null
+++ b/libcxx/test/containers/sequences/array/front_back.pass.cpp
@@ -0,0 +1,62 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// reference front();
+// reference back();
+// const_reference front(); // constexpr in C++14
+// const_reference back(); // constexpr in C++14
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+
+        C::reference r1 = c.front();
+        assert(r1 == 1);
+        r1 = 5.5;
+        assert(c[0] == 5.5);
+        
+        C::reference r2 = c.back();
+        assert(r2 == 3.5);
+        r2 = 7.5;
+        assert(c[2] == 7.5);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        const C c = {1, 2, 3.5};
+        C::const_reference r1 = c.front();
+        assert(r1 == 1);
+
+        C::const_reference r2 = c.back();
+        assert(r2 == 3.5);
+    }
+
+#if _LIBCPP_STD_VER > 11 
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr C c = {1, 2, 3.5};
+        
+        constexpr T t1 = c.front();
+        static_assert (t1 == 1, "");
+
+        constexpr T t2 = c.back();
+        static_assert (t2 == 3.5, "");
+    }
+#endif
+
+}
diff --git a/libcxx/test/containers/sequences/array/indexing.pass.cpp b/libcxx/test/containers/sequences/array/indexing.pass.cpp
new file mode 100644
index 0000000..e4dda0d
--- /dev/null
+++ b/libcxx/test/containers/sequences/array/indexing.pass.cpp
@@ -0,0 +1,60 @@
+//===----------------------------------------------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// <array>
+
+// reference operator[] (size_type)
+// const_reference operator[] (size_type); // constexpr in C++14
+// reference at (size_type)
+// const_reference at (size_type); // constexpr in C++14
+
+#include <array>
+#include <cassert>
+
+int main()
+{
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        C c = {1, 2, 3.5};
+        C::reference r1 = c[0];
+        assert(r1 == 1);
+        r1 = 5.5;
+        assert(c.front() == 5.5);
+        
+        C::reference r2 = c[2];
+        assert(r2 == 3.5);
+        r2 = 7.5;
+        assert(c.back() == 7.5);
+    }
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        const C c = {1, 2, 3.5};
+        C::const_reference r1 = c[0];
+        assert(r1 == 1);
+        C::const_reference r2 = c[2];
+        assert(r2 == 3.5);
+    }
+    
+#if _LIBCPP_STD_VER > 11 
+    {
+        typedef double T;
+        typedef std::array<T, 3> C;
+        constexpr C c = {1, 2, 3.5};
+        
+        constexpr T t1 = c[0];
+        static_assert (t1 == 1, "");
+
+        constexpr T t2 = c[2];
+        static_assert (t2 == 3.5, "");
+    }
+#endif
+
+}