public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49528] g++ fails to destroy temporary object when subobject is used to initialize a reference
2011-06-25 3:33 [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference jason at gcc dot gnu.org
@ 2011-06-25 3:33 ` jason at gcc dot gnu.org
2011-06-25 3:35 ` [Bug c++/49528] [4.6/4.7 regression] " jason at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-25 3:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49528
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.06.25 03:33:06
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference
@ 2011-06-25 3:33 jason at gcc dot gnu.org
2011-06-25 3:33 ` [Bug c++/49528] " jason at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-25 3:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49528
Summary: g++ fails to destroy temporary object when subobject
is used to initialize a reference
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: jason@gcc.gnu.org
I believe that r should point to a temporary int and the A temporary destroyed
at the end of the declaration statement rather than have its lifetime extended
to the end of the block. In any case, never destroying it is clearly broken.
int d;
struct A
{
int i;
~A() { ++d; };
};
int main()
{
{ const int &r = A().i; }
if (d != 1)
return 1;
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/49528] [4.6/4.7 regression] g++ fails to destroy temporary object when subobject is used to initialize a reference
2011-06-25 3:33 [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference jason at gcc dot gnu.org
2011-06-25 3:33 ` [Bug c++/49528] " jason at gcc dot gnu.org
@ 2011-06-25 3:35 ` jason at gcc dot gnu.org
2011-06-25 9:41 ` rguenth at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-25 3:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49528
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|g++ fails to destroy |[4.6/4.7 regression] g++
|temporary object when |fails to destroy temporary
|subobject is used to |object when subobject is
|initialize a reference |used to initialize a
| |reference
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-25 03:34:55 UTC ---
Hmm, looks like this worked in 4.5.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/49528] [4.6/4.7 regression] g++ fails to destroy temporary object when subobject is used to initialize a reference
2011-06-25 3:33 [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference jason at gcc dot gnu.org
2011-06-25 3:33 ` [Bug c++/49528] " jason at gcc dot gnu.org
2011-06-25 3:35 ` [Bug c++/49528] [4.6/4.7 regression] " jason at gcc dot gnu.org
@ 2011-06-25 9:41 ` rguenth at gcc dot gnu.org
2011-06-26 0:52 ` jason at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-06-25 9:41 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49528
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.6.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/49528] [4.6/4.7 regression] g++ fails to destroy temporary object when subobject is used to initialize a reference
2011-06-25 3:33 [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference jason at gcc dot gnu.org
` (2 preceding siblings ...)
2011-06-25 9:41 ` rguenth at gcc dot gnu.org
@ 2011-06-26 0:52 ` jason at gcc dot gnu.org
2011-06-26 14:00 ` jason at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-26 0:52 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49528
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/49528] [4.6/4.7 regression] g++ fails to destroy temporary object when subobject is used to initialize a reference
2011-06-25 3:33 [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference jason at gcc dot gnu.org
` (3 preceding siblings ...)
2011-06-26 0:52 ` jason at gcc dot gnu.org
@ 2011-06-26 14:00 ` jason at gcc dot gnu.org
2011-06-27 1:07 ` [Bug c++/49528] [4.6 " jason at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-26 14:00 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49528
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-26 14:00:37 UTC ---
Author: jason
Date: Sun Jun 26 14:00:33 2011
New Revision: 175409
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175409
Log:
PR c++/49528
* semantics.c (potential_constant_expression_1): A TARGET_EXPR
with a cleanup isn't constant.
(cxx_eval_constant_expression): Likewise.
* init.c (expand_default_init): Use maybe_constant_init.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-cleanup.C
trunk/gcc/testsuite/g++.dg/init/ref19.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/init.c
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/49528] [4.6 regression] g++ fails to destroy temporary object when subobject is used to initialize a reference
2011-06-25 3:33 [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference jason at gcc dot gnu.org
` (4 preceding siblings ...)
2011-06-26 14:00 ` jason at gcc dot gnu.org
@ 2011-06-27 1:07 ` jason at gcc dot gnu.org
2011-06-27 15:55 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-27 1:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49528
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-27 01:07:38 UTC ---
Author: jason
Date: Mon Jun 27 01:07:34 2011
New Revision: 175417
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175417
Log:
PR c++/49528
* semantics.c (potential_constant_expression_1): Check
for non-literality rather than cleanup.
(cxx_eval_constant_expression): Likewise.
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-cleanup.C
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/49528] [4.6 regression] g++ fails to destroy temporary object when subobject is used to initialize a reference
2011-06-25 3:33 [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference jason at gcc dot gnu.org
` (5 preceding siblings ...)
2011-06-27 1:07 ` [Bug c++/49528] [4.6 " jason at gcc dot gnu.org
@ 2011-06-27 15:55 ` jakub at gcc dot gnu.org
2011-06-27 20:17 ` jason at gcc dot gnu.org
2011-06-27 20:19 ` jason at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-06-27 15:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49528
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|4.6.1 |4.6.2
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-27 12:32:51 UTC ---
GCC 4.6.1 is being released.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/49528] [4.6 regression] g++ fails to destroy temporary object when subobject is used to initialize a reference
2011-06-25 3:33 [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference jason at gcc dot gnu.org
` (6 preceding siblings ...)
2011-06-27 15:55 ` jakub at gcc dot gnu.org
@ 2011-06-27 20:17 ` jason at gcc dot gnu.org
2011-06-27 20:19 ` jason at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-27 20:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49528
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-27 20:16:21 UTC ---
Author: jason
Date: Mon Jun 27 20:16:14 2011
New Revision: 175559
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175559
Log:
PR c++/49528
* semantics.c (potential_constant_expression_1): A TARGET_EXPR
of non-literal type isn't constant.
(cxx_eval_constant_expression): Likewise.
* init.c (expand_default_init): Use maybe_constant_init.
Added:
branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-cleanup.C
branches/gcc-4_6-branch/gcc/testsuite/g++.dg/init/ref19.C
Modified:
branches/gcc-4_6-branch/gcc/cp/ChangeLog
branches/gcc-4_6-branch/gcc/cp/init.c
branches/gcc-4_6-branch/gcc/cp/semantics.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/49528] [4.6 regression] g++ fails to destroy temporary object when subobject is used to initialize a reference
2011-06-25 3:33 [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference jason at gcc dot gnu.org
` (7 preceding siblings ...)
2011-06-27 20:17 ` jason at gcc dot gnu.org
@ 2011-06-27 20:19 ` jason at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2011-06-27 20:19 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49528
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2011-06-27 20:19:23 UTC ---
Fixed for 4.6.2.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-06-27 20:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-25 3:33 [Bug c++/49528] New: g++ fails to destroy temporary object when subobject is used to initialize a reference jason at gcc dot gnu.org
2011-06-25 3:33 ` [Bug c++/49528] " jason at gcc dot gnu.org
2011-06-25 3:35 ` [Bug c++/49528] [4.6/4.7 regression] " jason at gcc dot gnu.org
2011-06-25 9:41 ` rguenth at gcc dot gnu.org
2011-06-26 0:52 ` jason at gcc dot gnu.org
2011-06-26 14:00 ` jason at gcc dot gnu.org
2011-06-27 1:07 ` [Bug c++/49528] [4.6 " jason at gcc dot gnu.org
2011-06-27 15:55 ` jakub at gcc dot gnu.org
2011-06-27 20:17 ` jason at gcc dot gnu.org
2011-06-27 20:19 ` jason 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).