[libcxx-commits] [PATCH] D93246: [libc++] Remove unnecessary static assertion in allocate_shared

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 14 14:48:13 PST 2020


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb3d1d1f4fff8: [libc++] Remove unnecessary static assertion in allocate_shared (authored by ldionne).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93246/new/

https://reviews.llvm.org/D93246

Files:
  libcxx/include/memory
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.protected.verify.cpp
  libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.verify.cpp


Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.verify.cpp
===================================================================
--- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.protected.verify.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// GCC 5 does not evaluate static assertions dependent on a template parameter.
-// UNSUPPORTED: gcc-5
-
-// <memory>
-
-// shared_ptr
-
-// template<class T, class... Args> shared_ptr<T> make_shared(Args&&... args);
-
-#include <memory>
-
-#include "test_macros.h"
-
-struct S {
-protected:
-   S () {};  // ctor is protected
-};
-
-int main(int, char**) {
-  std::shared_ptr<S> p = std::make_shared<S>(); // expected-error at memory:* {{static_assert failed due to requirement 'is_constructible<S>::value}}
-
-  return 0;
-}
Index: libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.protected.verify.cpp
===================================================================
--- libcxx/test/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/allocate_shared.protected.verify.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// GCC 5 does not evaluate static assertions dependent on a template parameter.
-// UNSUPPORTED: gcc-5
-
-// <memory>
-
-// shared_ptr
-
-// template<class T, class A, class... Args>
-//    shared_ptr<T> allocate_shared(const A& a, Args&&... args);
-
-#include <memory>
-
-#include "test_macros.h"
-
-struct S {
-protected:
-   S () {};  // ctor is protected
-};
-
-int main(int, char**) {
-    typedef std::allocator<S> A;
-    A a;
-    std::shared_ptr<S> p = std::allocate_shared<S, A>(a); // expected-error at memory:* {{static_assert failed due to requirement 'is_constructible<S>::value}}
-
-    return 0;
-}
Index: libcxx/include/memory
===================================================================
--- libcxx/include/memory
+++ libcxx/include/memory
@@ -3307,8 +3307,6 @@
 _LIBCPP_HIDE_FROM_ABI
 shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&& ...__args)
 {
-    static_assert(is_constructible<_Tp, _Args...>::value,
-        "allocate_shared/make_shared: the type is not constructible from the provided arguments");
     using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>;
     using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type;
     __allocation_guard<_ControlBlockAllocator> __guard(__a, 1);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93246.311718.patch
Type: text/x-patch
Size: 3293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201214/b46047bd/attachment.bin>


More information about the libcxx-commits mailing list