From 61b9a7258a7693d7f3674a5a1daf7b036ff1d382 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 6 Sep 2015 18:46:46 +0000 Subject: Import libc++ 3.7.0 release (r246257). --- .../sequences/array/array.data/data.pass.cpp | 35 ++++++++++++++++++++++ .../sequences/array/array.data/data_const.pass.cpp | 35 ++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 test/std/containers/sequences/array/array.data/data.pass.cpp create mode 100644 test/std/containers/sequences/array/array.data/data_const.pass.cpp (limited to 'test/std/containers/sequences/array/array.data') diff --git a/test/std/containers/sequences/array/array.data/data.pass.cpp b/test/std/containers/sequences/array/array.data/data.pass.cpp new file mode 100644 index 0000000000000..08e4fd39d3771 --- /dev/null +++ b/test/std/containers/sequences/array/array.data/data.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// T *data(); + +#include +#include + +int main() +{ + { + typedef double T; + typedef std::array C; + C c = {1, 2, 3.5}; + T* p = c.data(); + assert(p[0] == 1); + assert(p[1] == 2); + assert(p[2] == 3.5); + } + { + typedef double T; + typedef std::array C; + C c = {}; + T* p = c.data(); + (void)p; // to placate scan-build + } +} diff --git a/test/std/containers/sequences/array/array.data/data_const.pass.cpp b/test/std/containers/sequences/array/array.data/data_const.pass.cpp new file mode 100644 index 0000000000000..8eb9762dcb89e --- /dev/null +++ b/test/std/containers/sequences/array/array.data/data_const.pass.cpp @@ -0,0 +1,35 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// + +// const T* data() const; + +#include +#include + +int main() +{ + { + typedef double T; + typedef std::array C; + const C c = {1, 2, 3.5}; + const T* p = c.data(); + assert(p[0] == 1); + assert(p[1] == 2); + assert(p[2] == 3.5); + } + { + typedef double T; + typedef std::array C; + const C c = {}; + const T* p = c.data(); + (void)p; // to placate scan-build + } +} -- cgit v1.2.3