//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// unique_ptr
// Test unique_ptr<T[]>(pointer) ctor
// unique_ptr<T[]>(pointer) ctor shouldn't require complete type
#include<memory>#include<cassert>structA;classDeleter{intstate_;Deleter(Deleter&);Deleter&operator=(Deleter&);public:Deleter():state_(5){}intstate()const{returnstate_;}voidoperator()(A*p);};voidcheck(inti);template<classD=std::default_delete<A[]>>structB{std::unique_ptr<A[],D>a_;explicitB(A*);~B();A*get()const{returna_.get();}D&get_deleter(){returna_.get_deleter();}};A*get();intmain(){{A*p=get();check(3);B<>s(p);assert(s.get()==p);}check(0);{A*p=get();check(3);B<Deleter>s(p);assert(s.get()==p);assert(s.get_deleter().state()==5);}check(0);}structA{staticintcount;A(){++count;}A(constA&){++count;}~A(){--count;}};intA::count=0;A*get(){returnnewA[3];}voidDeleter::operator()(A*p){delete[]p;}voidcheck(inti){assert(A::count==i);}template<classD>B<D>::B(A*a):a_(a){}template<classD>B<D>::~B(){}