public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "giovannibajo at libero dot it" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/14618] Cannot compile test_thread.cpp from boost Date: Wed, 17 Mar 2004 14:37:00 -0000 [thread overview] Message-ID: <20040317143749.23652.qmail@sources.redhat.com> (raw) In-Reply-To: <20040317093829.14618.schmid@snake.iap.physik.tu-darmstadt.de> [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain, Size: 1646 bytes --] ------- Additional Comments From giovannibajo at libero dot it 2004-03-17 14:37 ------- FWIW, I agree. We ran into this very problem also in PR 14528, it seems like GCC 3.4.0 is the first compiler to enforce this rule. Not even EDG does this. Standard paragraphs that apply: - [basic.lval]/6 says that "D()" is a rvalue. - [dcl.init.ref]/5, bullet 2 ("Otherwise, the reference shall be to a non- volatile const type"), sub-bullet 1: "If the initializer expression is a rvalue, the refence is bound in one of the following ways (the choice is implementation defined): - The reference is bound to the object represented by the rvalue (see 3.10) [...] A temporary of type cv1 T2 [sic] is created, and a constructor is called to copy the entire rvalue object into the temporary. The reference is bound to the temporary [...] ***The constructor that would be used to make the copy shall be callable whether or not the copy is actually done.***" The last sentence (with my stress) is the one that matters. Either GCC internally elides the copy or not, it does not matter, but the copy constructor has to be callable. - [class.temporary]/2 talks about this another time: "Temporaries of class type are created in various contexts: binding an rvalue to a reference, [...]. Even when the creation of the temporary object is avoided, all the semantic restrictions must be respected as if the temporary object was created. [Example: even if the copy constructor is not called, all the semantic restrictions, such as accessibility (clause 11), shall be satisfied.]". -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14618
next prev parent reply other threads:[~2004-03-17 14:37 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-03-17 9:38 [Bug c++/14618] New: " schmid at snake dot iap dot physik dot tu-darmstadt dot de 2004-03-17 13:52 ` [Bug c++/14618] " bangerth at dealii dot org 2004-03-17 14:37 ` giovannibajo at libero dot it [this message] 2004-03-17 15:08 ` gdr at integrable-solutions dot net 2004-03-17 15:11 ` gdr at integrable-solutions dot net 2004-03-17 22:54 ` [Bug c++/14618] Document copy constructor constraints in binding rvalues to references giovannibajo at libero dot it 2004-03-17 23:22 ` gdr at integrable-solutions dot net 2004-03-21 1:16 ` giovannibajo at libero dot it 2004-03-29 18:24 ` pinskia at gcc dot gnu dot org 2004-07-13 17:02 ` pinskia at gcc dot gnu dot 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=20040317143749.23652.qmail@sources.redhat.com \ --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).