1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // UNSUPPORTED: c++98, c++03, c++11 11 // <optional> 12 13 // struct nullopt_t{see below}; 14 // constexpr nullopt_t nullopt(unspecified); 15 16 #include <experimental/optional> 17 #include <type_traits> 18 19 using std::experimental::optional; 20 using std::experimental::nullopt_t; 21 using std::experimental::nullopt; 22 23 constexpr 24 int test(const nullopt_t &)25test(const nullopt_t&) 26 { 27 return 3; 28 } 29 main()30int main() 31 { 32 static_assert((std::is_class<nullopt_t>::value), ""); 33 static_assert((std::is_empty<nullopt_t>::value), ""); 34 static_assert((std::is_literal_type<nullopt_t>::value), ""); 35 static_assert((!std::is_default_constructible<nullopt_t>::value), ""); 36 37 static_assert(test(nullopt) == 3, ""); 38 } 39