12561885fSEric Fiselier //===----------------------------------------------------------------------===// 22561885fSEric Fiselier // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 62561885fSEric Fiselier // 72561885fSEric Fiselier //===----------------------------------------------------------------------===// 82561885fSEric Fiselier 9*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11 102561885fSEric Fiselier #include <memory> 112561885fSEric Fiselier #include <string> 122561885fSEric Fiselier #include <cassert> 132561885fSEric Fiselier 147fc6a556SMarshall Clow #include "test_macros.h" 157fc6a556SMarshall Clow main(int,char **)162df59c50SJF Bastienint main(int, char**) 172561885fSEric Fiselier { 182561885fSEric Fiselier { 192561885fSEric Fiselier std::unique_ptr<int> p1 = std::make_unique<int>(1); 202561885fSEric Fiselier assert ( *p1 == 1 ); 212561885fSEric Fiselier p1 = std::make_unique<int> (); 222561885fSEric Fiselier assert ( *p1 == 0 ); 232561885fSEric Fiselier } 242561885fSEric Fiselier 252561885fSEric Fiselier { 262561885fSEric Fiselier std::unique_ptr<std::string> p2 = std::make_unique<std::string> ( "Meow!" ); 272561885fSEric Fiselier assert ( *p2 == "Meow!" ); 282561885fSEric Fiselier p2 = std::make_unique<std::string> (); 292561885fSEric Fiselier assert ( *p2 == "" ); 302561885fSEric Fiselier p2 = std::make_unique<std::string> ( 6, 'z' ); 312561885fSEric Fiselier assert ( *p2 == "zzzzzz" ); 322561885fSEric Fiselier } 332df59c50SJF Bastien 342df59c50SJF Bastien return 0; 352561885fSEric Fiselier } 36