public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57610] New: Result of conversion
@ 2013-06-14 13:41 o_kniemeyer at maxon dot net
2013-06-14 13:42 ` [Bug c++/57610] " paolo.carlini at oracle dot com
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: o_kniemeyer at maxon dot net @ 2013-06-14 13:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
Bug ID: 57610
Summary: Result of conversion
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: o_kniemeyer at maxon dot net
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Result of conversion
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
@ 2013-06-14 13:42 ` paolo.carlini at oracle dot com
2013-06-14 13:43 ` o_kniemeyer at maxon dot net
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-14 13:42 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Result of conversion
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
2013-06-14 13:42 ` [Bug c++/57610] " paolo.carlini at oracle dot com
@ 2013-06-14 13:43 ` o_kniemeyer at maxon dot net
2013-06-14 13:48 ` [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result o_kniemeyer at maxon dot net
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: o_kniemeyer at maxon dot net @ 2013-06-14 13:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
--- Comment #2 from Ole Kniemeyer <o_kniemeyer at maxon dot net> ---
Created attachment 30301
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30301&action=edit
cpp file (without any #includes) which shows the bug
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
2013-06-14 13:42 ` [Bug c++/57610] " paolo.carlini at oracle dot com
2013-06-14 13:43 ` o_kniemeyer at maxon dot net
@ 2013-06-14 13:48 ` o_kniemeyer at maxon dot net
2013-06-14 13:51 ` o_kniemeyer at maxon dot net
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: o_kniemeyer at maxon dot net @ 2013-06-14 13:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
Ole Kniemeyer <o_kniemeyer at maxon dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |---
--- Comment #3 from Ole Kniemeyer <o_kniemeyer at maxon dot net> ---
In the example X can be converted to B which is a derived class of A. When an A
reference is initialized with an X object, the result of the X::operator B()
should be used directly for the A reference, but GCC creates a temporary A
object and initializes this by copy-construction from the conversion result.
At least if the classes use virtual functions, this leads to wrong results.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
` (2 preceding siblings ...)
2013-06-14 13:48 ` [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result o_kniemeyer at maxon dot net
@ 2013-06-14 13:51 ` o_kniemeyer at maxon dot net
2013-06-14 13:54 ` o_kniemeyer at maxon dot net
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: o_kniemeyer at maxon dot net @ 2013-06-14 13:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
--- Comment #4 from Ole Kniemeyer <o_kniemeyer at maxon dot net> ---
As I commented in the cpp example, the C++11 standard shows exactly this
example in sections 8.5.3. So this is definitely a bug according to C++11. I
think the GCC behaviour is correct according to older C++11 standards.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
` (3 preceding siblings ...)
2013-06-14 13:51 ` o_kniemeyer at maxon dot net
@ 2013-06-14 13:54 ` o_kniemeyer at maxon dot net
2013-08-23 18:03 ` hstong at ca dot ibm.com
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: o_kniemeyer at maxon dot net @ 2013-06-14 13:54 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
--- Comment #5 from Ole Kniemeyer <o_kniemeyer at maxon dot net> ---
Ops, sorry, of course I meant "... to older C++ standards."
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
` (4 preceding siblings ...)
2013-06-14 13:54 ` o_kniemeyer at maxon dot net
@ 2013-08-23 18:03 ` hstong at ca dot ibm.com
2014-10-20 21:21 ` kariya_mitsuru at hotmail dot com
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: hstong at ca dot ibm.com @ 2013-08-23 18:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
Hubert Tong <hstong at ca dot ibm.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hstong at ca dot ibm.com
--- Comment #8 from Hubert Tong <hstong at ca dot ibm.com> ---
Affects the candidate list for direct binding to a result of a conversion.
struct Z { };
struct A {
operator Z &&() const = delete; // GCC like this
operator Z();
};
void zip() {
Z &&x = A();
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
` (5 preceding siblings ...)
2013-08-23 18:03 ` hstong at ca dot ibm.com
@ 2014-10-20 21:21 ` kariya_mitsuru at hotmail dot com
2014-11-26 10:10 ` paolo.carlini at oracle dot com
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: kariya_mitsuru at hotmail dot com @ 2014-10-20 21:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
Mitsuru Kariya <kariya_mitsuru at hotmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kariya_mitsuru at hotmail dot com
--- Comment #10 from Mitsuru Kariya <kariya_mitsuru at hotmail dot com> ---
Each status of the issues mentioned above is
CWG 1287: DRWP
CWG 1604: DR
CWG 1650: NAD
And, gcc HEAD (5.0.0) does not cause the slicing problem.
cf. 5.0.0 http://melpon.org/wandbox/permlink/xQQq1n98s7blSz8x
cf. 4.9.1 http://melpon.org/wandbox/permlink/l69tDXdptf1WVdAT
Note that these are compiled with the option "-fno-elide-constructors".
(Sorry, I don't know whether this issue should be "RESOLVED FIXED" or not,
however.)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
` (6 preceding siblings ...)
2014-10-20 21:21 ` kariya_mitsuru at hotmail dot com
@ 2014-11-26 10:10 ` paolo.carlini at oracle dot com
2015-04-30 9:33 ` paolo.carlini at oracle dot com
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-11-26 10:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |paolo.carlini at oracle dot com
--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'm looking for somebody willing to *summarize* for me where do we stand on
this. Is GCC already Ok vs the most recent resolutions and we could resolve the
issue (maybe commit a testcase too)? Or ISO work is still pending and the bug
should be suspended, as usual in such cases? Something else? Thanks.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
` (7 preceding siblings ...)
2014-11-26 10:10 ` paolo.carlini at oracle dot com
@ 2015-04-30 9:33 ` paolo.carlini at oracle dot com
2015-04-30 9:44 ` paolo at gcc dot gnu.org
2015-04-30 9:44 ` paolo.carlini at oracle dot com
10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-04-30 9:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|paolo.carlini at oracle dot com |
--- Comment #12 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is fixed in 5.1. I'm adding a testcase and closing the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
` (8 preceding siblings ...)
2015-04-30 9:33 ` paolo.carlini at oracle dot com
@ 2015-04-30 9:44 ` paolo at gcc dot gnu.org
2015-04-30 9:44 ` paolo.carlini at oracle dot com
10 siblings, 0 replies; 12+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-04-30 9:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
--- Comment #13 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Thu Apr 30 09:43:39 2015
New Revision: 222615
URL: https://gcc.gnu.org/viewcvs?rev=222615&root=gcc&view=rev
Log:
2015-04-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/57610
* g++.dg/init/ref22.C: New.
Added:
trunk/gcc/testsuite/g++.dg/init/ref22.C
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
` (9 preceding siblings ...)
2015-04-30 9:44 ` paolo at gcc dot gnu.org
@ 2015-04-30 9:44 ` paolo.carlini at oracle dot com
10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-04-30 9:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57610
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |5.0
--- Comment #14 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2015-04-30 9:44 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-14 13:41 [Bug c++/57610] New: Result of conversion o_kniemeyer at maxon dot net
2013-06-14 13:42 ` [Bug c++/57610] " paolo.carlini at oracle dot com
2013-06-14 13:43 ` o_kniemeyer at maxon dot net
2013-06-14 13:48 ` [Bug c++/57610] Reference initialized with temporary instead of sub-object of conversion result o_kniemeyer at maxon dot net
2013-06-14 13:51 ` o_kniemeyer at maxon dot net
2013-06-14 13:54 ` o_kniemeyer at maxon dot net
2013-08-23 18:03 ` hstong at ca dot ibm.com
2014-10-20 21:21 ` kariya_mitsuru at hotmail dot com
2014-11-26 10:10 ` paolo.carlini at oracle dot com
2015-04-30 9:33 ` paolo.carlini at oracle dot com
2015-04-30 9:44 ` paolo at gcc dot gnu.org
2015-04-30 9:44 ` paolo.carlini at oracle dot com
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).