copy_ctor.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// class bad_optional_access; 13// bad_optional_access(const bad_optional_access&); 14 15#include <optional> 16#include <string> 17#include <cstring> 18#include <type_traits> 19#include <cassert> 20 21#if _LIBCPP_STD_VER > 11 22 23#endif // _LIBCPP_STD_VER > 11 24 25int main() 26{ 27#if _LIBCPP_STD_VER > 11 28 static_assert(std::is_nothrow_copy_constructible<std::bad_optional_access>::value, ""); 29 const std::string s("another message"); 30 std::bad_optional_access e1(s); 31 std::bad_optional_access e2 = e1; 32 assert(std::strcmp(e1.what(), e2.what()) == 0); 33#endif // _LIBCPP_STD_VER > 11 34} 35