Skip to content

[libc++] deque::prepend_range rejects some valid code #162605

@philnik777

Description

@philnik777
struct InPlaceOnly {
  constexpr InPlaceOnly() {}
  InPlaceOnly(const InPlaceOnly&) = delete;
  InPlaceOnly(InPlaceOnly&&) = delete;
  InPlaceOnly& operator=(const InPlaceOnly&) = delete;
  InPlaceOnly& operator=(InPlaceOnly&&) = delete;
};

struct EmplaceConstructible {
  EmplaceConstructible(const EmplaceConstructible&) = delete;
  EmplaceConstructible& operator=(const EmplaceConstructible&) = delete;
  EmplaceConstructible& operator=(EmplaceConstructible&&) = delete;
  EmplaceConstructible(EmplaceConstructible&&) = delete;
  constexpr EmplaceConstructible(const InPlaceOnly&) {}
};

template <template <class...> class Container>
constexpr void test_sequence_prepend_range_emplace_constructible() {
  InPlaceOnly input[5];
  types::for_each(types::cpp20_input_iterator_list<InPlaceOnly*>{}, [&]<class Iter> {
    std::ranges::subrange in(Iter(input), sentinel_wrapper<Iter>(Iter(input + 5)));
    Container<EmplaceConstructible> c;
    c.prepend_range(in);
  });
}

This code is correct, but currently rejected by our deque::prepend_range implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    libc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.rejects-valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions