//===----------------------------------------------------------------------===// // // 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 // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14 // // struct in_place_t { // explicit in_place_t() = default; // }; // inline constexpr in_place_t in_place{}; // template // struct in_place_type_t { // explicit in_place_type_t() = default; // }; // template // inline constexpr in_place_type_t in_place_type{}; // template // struct in_place_index_t { // explicit in_place_index_t() = default; // }; // template // inline constexpr in_place_index_t in_place_index{}; #include #include #include #include template constexpr bool check_tag(Up) { return std::is_same>::value && std::is_same::value; } int main(int, char**) { // test in_place_t { using T = std::in_place_t; static_assert(check_tag(std::in_place)); } // test in_place_type_t { using T1 = std::in_place_type_t; using T2 = std::in_place_type_t; using T3 = std::in_place_type_t; static_assert(!std::is_same::value && !std::is_same::value); static_assert(!std::is_same::value); static_assert(check_tag(std::in_place_type)); static_assert(check_tag(std::in_place_type)); static_assert(check_tag(std::in_place_type)); } // test in_place_index_t { using T1 = std::in_place_index_t<0>; using T2 = std::in_place_index_t<1>; using T3 = std::in_place_index_t(-1)>; static_assert(!std::is_same::value && !std::is_same::value); static_assert(!std::is_same::value); static_assert(check_tag(std::in_place_index<0>)); static_assert(check_tag(std::in_place_index<1>)); static_assert(check_tag(std::in_place_index(-1)>)); } return 0; }