blob: 72ef49b157f633c377eb26a85d08e48b721edc75 [file] [log] [blame]
Howard Hinnantcd2254b2010-11-17 19:52:17 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <array>
11
12// template <size_t I, class T, size_t N> T&& get(array<T, N>&& a);
13
Eric Fiselier02bb4bd2015-07-18 23:56:04 +000014// UNSUPPORTED: c++98, c++03
15
Howard Hinnantcd2254b2010-11-17 19:52:17 +000016#include <array>
17#include <memory>
Marshall Clow6b913d72015-01-09 20:25:52 +000018#include <utility>
Howard Hinnantcd2254b2010-11-17 19:52:17 +000019#include <cassert>
20
Eric Fiselier237206b2015-10-01 07:05:38 +000021// std::array is explicitly allowed to be initialized with A a = { init-list };.
22// Disable the missing braces warning for this reason.
23#include "disable_missing_braces_warning.h"
Eric Fiselier02bb4bd2015-07-18 23:56:04 +000024
Howard Hinnantcd2254b2010-11-17 19:52:17 +000025int main()
26{
Eric Fiselier02bb4bd2015-07-18 23:56:04 +000027
Howard Hinnantcd2254b2010-11-17 19:52:17 +000028 {
29 typedef std::unique_ptr<double> T;
30 typedef std::array<T, 1> C;
31 C c = {std::unique_ptr<double>(new double(3.5))};
32 T t = std::get<0>(std::move(c));
33 assert(*t == 3.5);
34 }
Howard Hinnantcd2254b2010-11-17 19:52:17 +000035}