]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/20_util/shared_ptr/cons/unique_ptr_deleter.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / shared_ptr / cons / unique_ptr_deleter.cc
index 67bf577c37829a2e659d0bade2edcda37266e125..3205cc37f1fe6c295258c01088fcefda25abff4e 100644 (file)
@@ -1,6 +1,6 @@
-// { dg-options "-std=gnu++11" }
+// { dg-do run { target c++11 } }
 
-// Copyright (C) 2008-2015 Free Software Foundation, Inc.
+// Copyright (C) 2008-2020 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -34,11 +34,9 @@ int D::count = 0;
 // 20.7.12.2.1 shared_ptr constructors [util.smartptr.shared.const]
 
 // Construction from unique_ptr
-int
+void
 test01()
 {
-  bool test __attribute__((unused)) = true;
-
   std::unique_ptr<A, D> up(new A, D());
   {
       std::shared_ptr<A> sp(std::move(up));
@@ -47,13 +45,23 @@ test01()
       VERIFY( sp.use_count() == 1 );
   }
   VERIFY( D::count == 1 );
+}
 
-  return 0;
+void
+test02()
+{
+  D::count = 0;
+  std::unique_ptr<A, D> up;
+  {
+    std::shared_ptr<A> sp = std::move(up);
+  }
+  VERIFY( D::count == 0 ); // LWG 2415
 }
 
 int
 main()
 {
   test01();
+  test02();
   return 0;
 }