Home | History | Annotate | Download | only in tuple.cnstr
      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 // <tuple>
     11 
     12 // template <class... Types> class tuple;
     13 
     14 // constexpr tuple();
     15 
     16 #include <tuple>
     17 #include <string>
     18 #include <cassert>
     19 
     20 #include "DefaultOnly.h"
     21 
     22 int main()
     23 {
     24     {
     25         std::tuple<> t;
     26     }
     27     {
     28         std::tuple<int> t;
     29         assert(std::get<0>(t) == 0);
     30     }
     31     {
     32         std::tuple<int, char*> t;
     33         assert(std::get<0>(t) == 0);
     34         assert(std::get<1>(t) == nullptr);
     35     }
     36     {
     37         std::tuple<int, char*, std::string> t;
     38         assert(std::get<0>(t) == 0);
     39         assert(std::get<1>(t) == nullptr);
     40         assert(std::get<2>(t) == "");
     41     }
     42     {
     43         std::tuple<int, char*, std::string, DefaultOnly> t;
     44         assert(std::get<0>(t) == 0);
     45         assert(std::get<1>(t) == nullptr);
     46         assert(std::get<2>(t) == "");
     47         assert(std::get<3>(t) == DefaultOnly());
     48     }
     49 #ifndef _LIBCPP_HAS_NO_CONSTEXPR
     50     {
     51         constexpr std::tuple<> t;
     52     }
     53     {
     54         constexpr std::tuple<int> t;
     55         assert(std::get<0>(t) == 0);
     56     }
     57     {
     58         constexpr std::tuple<int, char*> t;
     59         assert(std::get<0>(t) == 0);
     60         assert(std::get<1>(t) == nullptr);
     61     }
     62 #endif
     63 }
     64