[libcxx-commits] [PATCH] D93130: [libc++] Refactor allocate_shared to use an allocation guard

Sterling Augustine via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 14 22:06:05 PST 2020


saugustine added a comment.

This change appears to have dropped a constructor, or maybe two. I'm not familiar enough with all the requirements to know if that is correct or not. Here is a somewhat redacted version of the errors I get building a private application.

In module 'xyz':
.../include/c++/v1/memory:3341:48: error: no matching constructor for initialization of '__allocation_guard<_Foo>' (aka '__allocation_guard<Allocator<std::__u::__shared_ptr_emplace<Bar::Bat, Baz::Ball::Allocator<Bar::Bat>>>>')

  __allocation_guard<_Foo> __guard(__a, 1);
                                             ^       ~~~~~~

source.cc:57:15: note: in instantiation of function template specialization 'std::__u::allocate_shared<Bar::Bat, Baz::Ball::Allocator<Bar::Bat>, Bar::Bat::ConstructorToken, std::string_view &, Bar::BatOptions &, void>' requested here

  return std::allocate_shared<MemoryTracker>(Alloc(), ConstructorToken(), name,
              ^

.../include/c++/v1/__memory/utilities.h:52:14: note: candidate constructor not viable: no known conversion from 'const Allocator<Bar::Bat>' to 'Allocator<std::__u::__shared_ptr_emplace<Bar::Bat, Baz::Ball::Allocator<Bar::Bat>>>' for 1st argument

  explicit __allocation_guard(_Alloc __alloc, _Size __n)
           ^

.../include/c++/v1/__memory/utilities.h:47:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct __allocation_guard {

  ^

In module 'xyz':
.../include/c++/v1/memory:3341:48: error: no matching constructor for initialization of '__allocation_guard<_Foo>' (aka '__allocation_guard<Allocator<std::__u::__shared_ptr_emplace<Bar::Bat, Baz::Ball::Allocator<Bar::Bat>>>>')

  __allocation_guard<_Foo> __guard(__a, 1);
                                             ^       ~~~~~~

source.cc:229:16: note: in instantiation of function template specialization 'std::__u::allocate_shared<Bar::Bat, Baz::Ball::Allocator<Bar::Bat>, Bar::Bat::ConstructorToken, char const (&)[7], Bar::BatOptions, void>' requested here

  std::allocate_shared<MemoryTracker>(
       ^

.../include/c++/v1/__memory/utilities.h:52:14: note: candidate constructor not viable: no known conversion from 'const Allocator<Bar::Bat>' to 'Allocator<std::__u::__shared_ptr_emplace<Bar::Bat, Baz::Ball::Allocator<Bar::Bat>>>' for 1st argument

  explicit __allocation_guard(_Alloc __alloc, _Size __n)
           ^

.../include/c++/v1/__memory/utilities.h:47:8: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
struct __allocation_guard {


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93130



More information about the libcxx-commits mailing list