diff options
Diffstat (limited to 'libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp')
-rw-r--r-- | libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp b/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp index caebd4ae700..28a5a57edea 100644 --- a/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp +++ b/libcxx/test/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/pointer.pass.cpp @@ -1 +1 @@ -//===----------------------------------------------------------------------===//
//
// ΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚΚThe LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class Y> explicit shared_ptr(Y* p);
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* ptr = new A;
std::shared_ptr<A> p(ptr);
assert(A::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
}
assert(A::count == 0);
{
A* ptr = new A;
std::shared_ptr<void> p(ptr);
assert(A::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
}
assert(A::count == 0);
}
\ No newline at end of file +//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <memory>
// template<class Y> explicit shared_ptr(Y* p);
#include <memory>
#include <cassert>
struct A
{
static int count;
A() {++count;}
A(const A&) {++count;}
~A() {--count;}
};
int A::count = 0;
int main()
{
{
A* ptr = new A;
std::shared_ptr<A> p(ptr);
assert(A::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
}
assert(A::count == 0);
{
A* ptr = new A;
std::shared_ptr<void> p(ptr);
assert(A::count == 1);
assert(p.use_count() == 1);
assert(p.get() == ptr);
}
assert(A::count == 0);
}
\ No newline at end of file |