diff --git a/libcxx/test/std/utilities/meta/meta.unary/dependent_return_type.compile.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/dependent_return_type.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/utilities/meta/meta.unary/dependent_return_type.compile.pass.cpp @@ -0,0 +1,168 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Check that all the type_trait aliases can be mangled + +// UNSUPPORTED: c++03, c++11 + +// ignore deprecated volatile return types +// ADDITIONAL_COMPILE_FLAGS: -Wno-deprecated-volatile + +#include +#include + +#include "test_macros.h" + +template +std::add_const_t add_const() { + return {}; +} + +template +std::add_cv_t add_cv() { + return {}; +} + +template +std::add_lvalue_reference_t add_lvalue_reference() { + static int i; + return i; +} + +template +std::add_pointer_t add_pointer() { + return {}; +} + +template +std::add_rvalue_reference_t add_rvalue_reference() { + static int i; + return std::move(i); +} + +template +std::add_volatile_t add_volatile() { + static int i; + return std::move(i); +} + +template +std::conditional_t conditional() { + return {}; +} + +template +std::decay_t decay() { + return {}; +} + +template +std::enable_if_t enable_if() { + return {}; +} + +template +std::make_signed_t make_signed() { + return {}; +} + +template +std::make_unsigned_t make_unsigned() { + return {}; +} + +template +std::remove_all_extents_t remove_all_extents() { + return {}; +} + +template +std::remove_const_t remove_const() { + return {}; +} + +template +std::remove_cv_t remove_cv() { + return {}; +} + +#if TEST_STD_VER >= 20 +template +std::remove_cvref_t remove_cvref() { + return {}; +} +#endif + +template +std::remove_extent_t remove_extent() { + return {}; +} + +template +std::remove_pointer_t remove_pointer() { + return {}; +} + +template +std::remove_reference_t remove_reference() { + return {}; +} + +template +std::remove_volatile_t remove_volatile() { + return {}; +} + +#if TEST_STD_VER >= 20 +template +std::type_identity_t type_identity() { + return {}; +} +#endif + +template +std::underlying_type_t underlying_type() { + return {}; +} + +enum class E : int {}; + +#if TEST_STD_VER >= 17 +template +std::void_t void_t() {} +#endif + +void instantiate() { + add_const(); + add_cv(); + add_lvalue_reference(); + add_pointer(); + add_rvalue_reference(); + add_volatile(); + decay(); + enable_if(); + make_signed(); + make_unsigned(); + remove_all_extents(); + remove_const(); + remove_cv(); +#if TEST_STD_VER >= 20 + remove_cvref(); +#endif + remove_extent(); + remove_pointer(); + remove_reference(); + remove_volatile(); +#if TEST_STD_VER >= 20 + type_identity(); +#endif + underlying_type(); +#if TEST_STD_VER >= 17 + void_t(); +#endif +}