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 // explicit tuple(const T&...);
     15 
     16 // UNSUPPORTED: c++98, c++03
     17 
     18 #include <tuple>
     19 #include <string>
     20 #include <cassert>
     21 
     22 struct ExplicitCopy {
     23   ExplicitCopy(int) {}
     24   explicit ExplicitCopy(ExplicitCopy const&) {}
     25 };
     26 
     27 std::tuple<ExplicitCopy> const_explicit_copy() {
     28     const ExplicitCopy e(42);
     29     return {e};
     30     // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
     31 }
     32 
     33 
     34 std::tuple<ExplicitCopy> non_const_explicit_copy() {
     35     ExplicitCopy e(42);
     36     return {e};
     37     // expected-error@-1 {{chosen constructor is explicit in copy-initialization}}
     38 }
     39 
     40 std::tuple<ExplicitCopy> const_explicit_copy_no_brace() {
     41     const ExplicitCopy e(42);
     42     return e;
     43     // expected-error@-1 {{no viable conversion}}
     44 }
     45 
     46 int main()
     47 {
     48 }
     49