//===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // Make sure that std::allocate_shared works with an allocator type that is // only explicitly convertible from another specialization of itself. #include #include #include template struct ExplicitAllocator { ExplicitAllocator() = default; template explicit ExplicitAllocator(ExplicitAllocator) { } using value_type = T; T* allocate(std::size_t n) { return std::allocator().allocate(n); } void deallocate(T* ptr, std::size_t n) { return std::allocator().deallocate(ptr, n); } }; int main(int, char**) { std::shared_ptr ptr = std::allocate_shared(ExplicitAllocator(), 0); (void)ptr; return 0; }