public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "de34 at live dot cn" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/104443] New: common_iterator<I, S>::operator-> is not correctly implemented Date: Tue, 08 Feb 2022 17:40:17 +0000 [thread overview] Message-ID: <bug-104443-4@http.gcc.gnu.org/bugzilla/> (raw) 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.
next reply other threads:[~2022-02-08 17:40 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-08 17:40 de34 at live dot cn [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-104443-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).