Eric Fiselier | 95526d3 | 2016-04-19 01:19:25 +0000 | [diff] [blame] | 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 | // template <class Alloc> |
| 15 | // EXPLICIT tuple(allocator_arg_t, const Alloc& a, const Types&...); |
| 16 | |
| 17 | // UNSUPPORTED: c++98, c++03 |
| 18 | |
| 19 | #include <tuple> |
| 20 | #include <memory> |
| 21 | #include <cassert> |
| 22 | |
| 23 | struct ExplicitCopy { |
| 24 | explicit ExplicitCopy(ExplicitCopy const&) {} |
| 25 | explicit ExplicitCopy(int) {} |
| 26 | }; |
| 27 | |
| 28 | std::tuple<ExplicitCopy> const_explicit_copy_test() { |
| 29 | const ExplicitCopy e(42); |
| 30 | return {std::allocator_arg, std::allocator<void>{}, e}; |
| 31 | // expected-error@-1 {{chosen constructor is explicit in copy-initialization}} |
| 32 | } |
| 33 | |
| 34 | std::tuple<ExplicitCopy> non_const_explicity_copy_test() { |
| 35 | ExplicitCopy e(42); |
| 36 | return {std::allocator_arg, std::allocator<void>{}, e}; |
| 37 | // expected-error@-1 {{chosen constructor is explicit in copy-initialization}} |
| 38 | } |
| 39 | int main() |
| 40 | { |
| 41 | const_explicit_copy_test(); |
| 42 | non_const_explicity_copy_test(); |
| 43 | } |