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