On 26/05/20 15:18 -0400, Patrick Palka via Libstdc++ wrote:
This patch fixes the definition of common_iterator::operator-> when the
underlying iterator type's operator* returns a non-reference.
The first problem is that the class __detail::_Common_iter_proxy is used
unqualified. Fixing that revealed another problem: the class's template
friend declaration of common_iterator doesn't match up with the
definition of common_iterator, because the friend declaration isn't
constrained.
If we try to make the friend declaration match up by adding constraints,
we run into frontend bug PR93467. So we currently can't correctly
express this friend relation between __detail::_Common_iter_proxy and
common_iterator.
As a workaround to this frontend bug, this patch moves the definition of
_Common_iter_proxy into the class template of common_iterator so that we
could instead express the friend relation via the injected-class-name.
OK. I put it at namespace scope originally because it only depends on
the iterator not the sentinel, so we'd only instantiate it once for
common_iterator<X,Y> and common_iterator<X,Z>, but this is fine.
(This bug was found when attempting to use views::common to work around
the compile failure of the testcase in PR95322.)
Tested on x86_64-pc-linux-gnu, does this look OK to commit?
Yes, thanks. OK for gcc-10 too.
Please be aware of the new ChangeLog policies announced on the lists
recently.