Created on 2020-02-29.00:00:00 last changed 13 months ago
Proposed resolution:
This wording is relative to N4861.
Modify [iterator.traits] as indicated:
-2- The definitions in this subclause make use of the following exposition-only concepts:
template<class I> concept cpp17-iterator =copyable<I> &&requires(I i) { { *i } -> can-reference; { ++i } -> same_as<I&>; { *i++ } -> can-reference; } && copyable<I>; […]
[ 2020-11-09 Approved In November virtual meeting. Status changed: Tentatively Ready → WP. ]
[ 2020-04-04 Issue Prioritization ]
Status set to Tentatively Ready after six positive votes on the reflector.
It is common in pre-C++20 code to rely on SFINAE-friendly iterator_traits to rule out non-iterators in template constraints (std::filesystem::path is one example in the standard library).
C++20 changed iterator_traits to automatically detect its members in some cases, and this detection can cause constraint recursion. LWG 3244 tries to fix this for path by short-circuiting the check when the source type is path itself, but this isn't sufficient:struct Foo { Foo(const std::filesystem::path&); }; static_assert(std::copyable<Foo>);
Here the copyability determination will ask whether a path can be constructed from a Foo, which asks whether Foo is an iterator, which checks whether Foo is copyable […].
To reduce the risk of constraint recursion, we should change cpp17-iterator so that it does not ask about copyability until the type is known to resemble an iterator.History | |||
---|---|---|---|
Date | User | Action | Args |
2023-11-22 15:47:43 | admin | set | status: wp -> c++23 |
2020-11-09 21:40:50 | admin | set | messages: + msg11567 |
2020-11-09 21:40:50 | admin | set | status: ready -> wp |
2020-04-04 18:43:37 | admin | set | messages: + msg11187 |
2020-04-04 18:43:37 | admin | set | status: new -> ready |
2020-03-30 15:43:05 | admin | set | messages: + msg11182 |
2020-02-29 00:00:00 | admin | create |