public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/104443] New: common_iterator<I, S>::operator-> is not correctly implemented
@ 2022-02-08 17:40 de34 at live dot cn
  2022-02-08 17:48 ` [Bug libstdc++/104443] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: de34 at live dot cn @ 2022-02-08 17:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104443

            Bug ID: 104443
           Summary: common_iterator<I, S>::operator-> is not correctly
                    implemented
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: de34 at live dot cn
  Target Milestone: ---

When the adapted iterator type I is a pointer type or has operator->,
std::common_iterator<I, S>::operator-> is required to return the iterator by
reference ([common.iter.access]/(5.1), and std::get for std::variant always
returns reference).

However, currently libstdc++'s implementation returns the iterator by value in
these cases, because "return _M_it;" is used and the return type is specified
by decltype(auto). "return (_M_it);" should be used instead.

Currently only libc++ correctly implements both common_iterator<I,
S>::operator-> and iterator_traits<common_iterator<I, S>>::pointer. See
https://gcc.godbolt.org/z/1Tn5cGrhh.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-09-07 17:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-08 17:40 [Bug libstdc++/104443] New: common_iterator<I, S>::operator-> is not correctly implemented de34 at live dot cn
2022-02-08 17:48 ` [Bug libstdc++/104443] " redi at gcc dot gnu.org
2022-02-09 16:08 ` redi at gcc dot gnu.org
2022-02-09 20:49 ` redi at gcc dot gnu.org
2022-02-12 11:52 ` redi at gcc dot gnu.org
2022-07-28 10:55 ` de34 at live dot cn
2022-07-29  9:11 ` cvs-commit at gcc dot gnu.org
2022-07-29  9:12 ` redi at gcc dot gnu.org
2022-08-03 13:47 ` cvs-commit at gcc dot gnu.org
2022-08-03 13:49 ` redi at gcc dot gnu.org
2022-09-07 17:49 ` cvs-commit at gcc dot gnu.org
2022-09-07 17:53 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).