<array>: array<const T, 0> allows fill() and swap()
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
Similar-but-distinct from #942; we should track it as a separate issue. The following libcxx tests are skipped:
https://github.com/microsoft/STL/blob/9e76d8c3d3700e086f3fbedd0c5b71f1678e4796/tests/libcxx/expected_results.txt#L543-L545
https://github.com/microsoft/STL/blob/9e76d8c3d3700e086f3fbedd0c5b71f1678e4796/tests/libcxx/skipped_tests.txt#L543-L545
Because they're implemented as no-ops:
WG21-N4861 [array.members]/3 specifies fill() with "Effects: As if by fill_n(begin(), N, u)." and /4 specifies swap() with "Effects: Equivalent to swap_ranges(begin(), end(), y.begin())."
Notably, these "equivalent to" calls are ill-formed for const T (even if there happen to be zero of them), so libcxx is correct to expect these to fail to compile (this is what meow.fail.cpp means).
We should be able to fix this without breaking ABI; static_assert should be sufficient.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the fill() and swap() implementations in stl/inc/array around the referenced lines, then inspect the corresponding libcxx entries in tests/libcxx/expected_results.txt and skipped_tests.txt. Run the relevant libcxx compile-fail tests; done means array<const T, 0> no longer accepts fill() or swap() while ABI remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100