public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nimrodcowboy at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/106223] difference in behaviour between no optimization and -O for specialization of std::forward Date: Thu, 07 Jul 2022 09:25:16 +0000 [thread overview] Message-ID: <bug-106223-4-zlh08rXzl1@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106223-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106223 --- Comment #4 from Nimrod <nimrodcowboy at gmail dot com> --- Ok, that somehow makes sense to me. I agree with the forwarding part, as a normal case, is doing nothing and keep the type. But I don't find any wordings about "value" or "internal state" in terms of "(perfect) forwarding", I believe it's only about the types? (If so, the example does conforms it.) https://timsong-cpp.github.io/cppwp/n4659/forward#1 The standard states std::forward as a helper function to simplify forwarding. "The library provides templated helper functions to simplify applying move semantics to an lvalue and to simplify the implementation of forwarding functions. All functions specified in this subclause are signal-safe ([csignal.syn])." https://timsong-cpp.github.io/cppwp/n4659/func.require#3 "...A forwarding call wrapper is a call wrapper that can be called with an arbitrary argument list and delivers the arguments to the wrapped callable object as references. This forwarding step shall ensure that rvalue arguments are delivered as rvalue references and lvalue arguments are delivered as lvalue references...." https://timsong-cpp.github.io/cppwp/n4659/temp.deduct.call#3 "A forwarding reference is an rvalue reference to a cv-unqualified template parameter that does not represent a template parameter of a class template (during class template argument deduction). If P is a forwarding reference and the argument is an lvalue, the type “lvalue reference to A” is used in place of A for type deduction."
next prev parent reply other threads:[~2022-07-07 9:25 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-07-07 8:37 [Bug c++/106223] New: " nimrodcowboy at gmail dot com 2022-07-07 8:40 ` [Bug c++/106223] " pinskia at gcc dot gnu.org 2022-07-07 8:51 ` nimrodcowboy at gmail dot com 2022-07-07 8:55 ` pinskia at gcc dot gnu.org 2022-07-07 9:25 ` nimrodcowboy at gmail dot com [this message] 2022-07-07 9:58 ` redi at gcc dot gnu.org 2022-07-07 11:01 ` redi at gcc dot gnu.org 2022-07-07 15:53 ` nimrodcowboy at gmail dot com 2022-07-07 16:02 ` nimrodcowboy at gmail dot com 2022-07-07 16:03 ` nimrodcowboy at gmail dot com 2022-07-07 16:59 ` 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-106223-4-zlh08rXzl1@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).