| 1 | //===----------------------------------------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | // UNSUPPORTED: c++03, c++11, c++14, c++17 |
| 10 | |
| 11 | // constexpr common_iterator() requires default_initializable<I> = default; |
| 12 | |
| 13 | #include <iterator> |
| 14 | #include <cassert> |
| 15 | |
| 16 | #include "test_iterators.h" |
| 17 | |
| 18 | constexpr bool test() |
| 19 | { |
| 20 | { |
| 21 | using It = cpp17_input_iterator<int*>; |
| 22 | using CommonIt = std::common_iterator<It, sentinel_wrapper<It>>; |
| 23 | static_assert(!std::is_default_constructible_v<It>); // premise |
| 24 | static_assert(!std::is_default_constructible_v<CommonIt>); // conclusion |
| 25 | } |
| 26 | { |
| 27 | // The base iterator is value-initialized. |
| 28 | std::common_iterator<int*, sentinel_wrapper<int*>> c; |
| 29 | assert(c == nullptr); |
| 30 | } |
| 31 | |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | int main(int, char**) { |
| 36 | test(); |
| 37 | static_assert(test()); |
| 38 | |
| 39 | return 0; |
| 40 | } |
| 41 | |