//===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, 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 "test_macros.h" #include "type_id.h" template constexpr bool check_tag(Up) { return std::is_same>::value && std::is_same::value; } int main() { // 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)>)); } }