1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++98, c++03, c++11
10 #include <memory>
11 #include <string>
12 #include <cassert>
13 
14 int main(int, char**)
15 {
16     {
17     std::unique_ptr<int> p1 = std::make_unique<int>(1);
18     assert ( *p1 == 1 );
19     p1 = std::make_unique<int> ();
20     assert ( *p1 == 0 );
21     }
22 
23     {
24     std::unique_ptr<std::string> p2 = std::make_unique<std::string> ( "Meow!" );
25     assert ( *p2 == "Meow!" );
26     p2 = std::make_unique<std::string> ();
27     assert ( *p2 == "" );
28     p2 = std::make_unique<std::string> ( 6, 'z' );
29     assert ( *p2 == "zzzzzz" );
30     }
31 
32   return 0;
33 }
34