Files
libcxx/test/std/language.support/support.dynamic/align_val_t.pass.cpp
Eric Fiselier 9acbffa370 Implement P0035R4 -- Add C++17 aligned allocation functions
Summary:
This patch implements the library side of P0035R4. The implementation is thanks to @rsmith.

In addition to the C++17 implementation, the library implementation can be explicitly turned on using `-faligned-allocation` in all dialects.


Reviewers: mclow.lists, rsmith

Subscribers: rsmith, cfe-commits

Differential Revision: https://reviews.llvm.org/D25591

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@284206 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-14 06:46:30 +00:00

34 lines
1.2 KiB
C++

//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// enum class align_val_t : size_t {}
// UNSUPPORTED: c++98, c++03, c++11, c++14
#include <new>
#include "test_macros.h"
int main() {
{
static_assert(std::is_enum<std::align_val_t>::value, "");
static_assert(std::is_same<std::underlying_type<std::align_val_t>::type, std::size_t>::value, "");
static_assert(!std::is_constructible<std::align_val_t, std::size_t>::value, "");
static_assert(!std::is_constructible<std::size_t, std::align_val_t>::value, "");
}
{
constexpr auto a = std::align_val_t(0);
constexpr auto b = std::align_val_t(32);
constexpr auto c = std::align_val_t(-1);
static_assert(a != b, "");
static_assert(a == std::align_val_t(0), "");
static_assert(b == std::align_val_t(32), "");
static_assert(static_cast<std::size_t>(c) == (std::size_t)-1, "");
}
}