| 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 |
// enum class align_val_t : size_t {} |
| 10 |
|
| 11 |
// UNSUPPORTED: c++03, c++11, c++14 |
| 12 |
|
| 13 |
// Libc++ when built for z/OS doesn't contain the aligned allocation functions, |
| 14 |
// nor does the dynamic library shipped with z/OS. |
| 15 |
// XFAIL: target={{.+}}-zos{{.*}} |
| 16 |
|
| 17 |
#include <new> |
| 18 |
#include <type_traits> |
| 19 |
|
| 20 |
#include "test_macros.h" |
| 21 |
|
| 22 |
int main(int, char**) { |
| 23 |
{ |
| 24 |
static_assert(std::is_enum<std::align_val_t>::value, ""); |
| 25 |
static_assert(std::is_same<std::underlying_type<std::align_val_t>::type, std::size_t>::value, ""); |
| 26 |
static_assert(!std::is_constructible<std::align_val_t, std::size_t>::value, ""); |
| 27 |
static_assert(!std::is_constructible<std::size_t, std::align_val_t>::value, ""); |
| 28 |
} |
| 29 |
{ |
| 30 |
constexpr auto a = std::align_val_t(0); |
| 31 |
constexpr auto b = std::align_val_t(32); |
| 32 |
constexpr auto c = std::align_val_t(-1); |
| 33 |
static_assert(a != b, ""); |
| 34 |
static_assert(a == std::align_val_t(0), ""); |
| 35 |
static_assert(b == std::align_val_t(32), ""); |
| 36 |
static_assert(static_cast<std::size_t>(c) == (std::size_t)-1, ""); |
| 37 |
} |
| 38 |
|
| 39 |
return 0; |
| 40 |
} |