Home | History | Annotate | Download | only in optional.object.observe
      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, c++14
     11 // <optional>
     12 
     13 // constexpr const T& optional<T>::value() const &;
     14 
     15 #include <optional>
     16 #include <type_traits>
     17 #include <cassert>
     18 
     19 using std::optional;
     20 
     21 struct X
     22 {
     23     constexpr int test() const {return 3;}
     24     int test() {return 4;}
     25 };
     26 
     27 int main()
     28 {
     29     {
     30         constexpr optional<X> opt;
     31         static_assert(opt.value().test() == 3, "");
     32     }
     33 }
     34