1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // const T* data() const;
17 #include "test_macros.h"
19 // std::array is explicitly allowed to be initialized with A a = { init-list };.
20 // Disable the missing braces warning for this reason.
21 #include "disable_missing_braces_warning.h"
27 typedef std::array<T, 3> C;
28 const C c = {1, 2, 3.5};
29 const T* p = c.data();
36 typedef std::array<T, 0> C;
38 const T* p = c.data();
39 (void)p; // to placate scan-build
43 typedef std::array<int, 5> C;
44 constexpr C c1{0,1,2,3,4};
45 constexpr const C c2{0,1,2,3,4};
47 static_assert ( c1.data() == &c1[0], "");
48 static_assert ( *c1.data() == c1[0], "");
49 static_assert ( c2.data() == &c2[0], "");
50 static_assert ( *c2.data() == c2[0], "");