Home | History | Annotate | Download | only in any.observers
      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
     11 
     12 // XFAIL: libcpp-no-rtti
     13 
     14 // <experimental/any>
     15 
     16 // any::type() noexcept
     17 
     18 #include <experimental/any>
     19 #include <cassert>
     20 #include "experimental_any_helpers.h"
     21 
     22 int main()
     23 {
     24     using std::experimental::any;
     25     {
     26         any const a;
     27         assert(a.type() == typeid(void));
     28         static_assert(noexcept(a.type()), "any::type() must be noexcept");
     29     }
     30     {
     31         small const s(1);
     32         any const a(s);
     33         assert(a.type() == typeid(small));
     34 
     35     }
     36     {
     37         large const l(1);
     38         any const a(l);
     39         assert(a.type() == typeid(large));
     40     }
     41 }
     42