brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · b7dfc19 Raw
27 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// Make sure that std::allocator<void> is trivial. This was the case before C++2010// with the std::allocator<void> explicit specialization, and this test makes sure11// that we maintain that property across all standards.12//13// This is important since triviality has implications on how the type is passed14// 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