string.pass.cpp revision 0cdbe6048173c1f05628dbc85430acf191a3e173
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// explicit bad_optional_access(const string& what_arg);
14
15#include <experimental/optional>
16#include <string>
17#include <cstring>
18#include <cassert>
19
20int main()
21{
22#if _LIBCPP_STD_VER > 11
23    using std::experimental::bad_optional_access;
24
25    const std::string s("message");
26    bad_optional_access e(s);
27    assert(std::strcmp(e.what(), s.c_str()) == 0);
28#endif  // _LIBCPP_STD_VER > 11
29}
30