types.pass.cpp revision 01afa5c6e407e985d9643707d7b7ab1384bd9317
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// <optional> 11 12// template <class T> 13// class optional 14// { 15// public: 16// typedef T value_type; 17// ... 18 19#include <optional> 20#include <type_traits> 21 22#if _LIBCPP_STD_VER > 11 23 24template <class Opt, class T> 25void 26test() 27{ 28 static_assert(std::is_same<typename Opt::value_type, T>::value, ""); 29} 30 31#endif // _LIBCPP_STD_VER > 11 32 33int main() 34{ 35#if _LIBCPP_STD_VER > 11 36 test<std::optional<int>, int>(); 37 test<std::optional<const int>, const int>(); 38 test<std::optional<double>, double>(); 39 test<std::optional<const double>, const double>(); 40#endif // _LIBCPP_STD_VER > 11 41} 42