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 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: c++98, c++03, c++11
15 // The only way to create an unique_ptr<T[]> is to default construct them.
20 int get () const { return val_; }
28 auto p1 = std::make_unique<int[]>(5);
29 for ( int i = 0; i < 5; ++i )
30 assert ( p1[i] == 0 );
34 auto p2 = std::make_unique<std::string[]>(5);
35 for ( int i = 0; i < 5; ++i )
36 assert ( p2[i].size () == 0 );
40 auto p3 = std::make_unique<foo[]>(7);
41 for ( int i = 0; i < 7; ++i )
42 assert ( p3[i].get () == 3 );