1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9// Make sure that std::allocator<void> is trivial. This was the case before C++20
10// with the std::allocator<void> explicit specialization, and this test makes sure
11// that we maintain that property across all standards.
12//
13// This is important since triviality has implications on how the type is passed
14// as a function argument in the ABI.
15
16#include <memory>
17#include <type_traits>
18
19typedef std::allocator<void> A1;
20struct A2 : std::allocator<void> { };
21
22static_assert(std::is_trivially_default_constructible<A1>::value, "");
23static_assert(std::is_trivially_copyable<A1>::value, "");
24
25static_assert(std::is_trivially_default_constructible<A2>::value, "");
26static_assert(std::is_trivially_copyable<A2>::value, "");
27

source code of libcxx/test/libcxx/memory/allocator_void.trivial.compile.pass.cpp