public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/41449] Partial aggregate initialization not cleaned up on exception
  2009-09-23 15:55 [Bug c++/41449] New: Partial aggregate initialization not cleaned up on exception jason at gcc dot gnu dot org
@ 2009-09-23 15:55 ` jason at gcc dot gnu dot org
  2009-12-15  4:03 ` jason at gcc dot gnu dot org
  1 sibling, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-09-23 15:55 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-09-23 15:55:40
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41449


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/41449]  New: Partial aggregate initialization not cleaned up on exception
@ 2009-09-23 15:55 jason at gcc dot gnu dot org
  2009-09-23 15:55 ` [Bug c++/41449] " jason at gcc dot gnu dot org
  2009-12-15  4:03 ` jason at gcc dot gnu dot org
  0 siblings, 2 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-09-23 15:55 UTC (permalink / raw)
  To: gcc-bugs

15.2 says "An object that is partially constructed or partially destroyed will
have destructors executed for all of its fully constructed base classes and
non-variant members, that is, for subobjects for which the principal
constructor (12.6.2) has completed execution and the destructor has not yet
begun execution."  We do this for objects that are created via constructor, and
for array initialization, but not for aggregate initialization of a class:

struct A
{ 
  A() {}
  A(const A&) { throw 1; }
};

int bs;
struct B
{
  B() { ++bs; }
  B(const B&) { ++bs; }
  ~B() { --bs; }
};

struct C
{ 
  B b1;
  A a;
  B b2;
};

int main()
{
  {
    B b1, b2;
    A a;

    try {
      C c = { b1, a, b2 };
    } catch (...) {}
  }
  return bs;
}

icc gets this right.


-- 
           Summary: Partial aggregate initialization not cleaned up on
                    exception
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jason at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41449


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/41449] Partial aggregate initialization not cleaned up on exception
  2009-09-23 15:55 [Bug c++/41449] New: Partial aggregate initialization not cleaned up on exception jason at gcc dot gnu dot org
  2009-09-23 15:55 ` [Bug c++/41449] " jason at gcc dot gnu dot org
@ 2009-12-15  4:03 ` jason at gcc dot gnu dot org
  1 sibling, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-12-15  4:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jason at gcc dot gnu dot org  2009-12-15 04:02 -------
Perhaps this is related to bug 11633.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41449


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/41449] Partial aggregate initialization not cleaned up on exception
       [not found] <bug-41449-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-10-20 19:19 ` jason at gcc dot gnu.org
@ 2011-10-25 18:24 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-25 18:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41449

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-25 18:24:32 UTC ---
Author: jason
Date: Tue Oct 25 18:24:28 2011
New Revision: 180442

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180442
Log:
    PR c++/50866
    PR c++/41449
    * semantics.c (maybe_cleanup_point_expr_void): No longer static.
    * typeck2.c (split_nonconstant_init_1): Use it.
    * cp-tree.h: Declare it.
    * decl.c (wrap_cleanups_r): Stop at CLEANUP_POINT_EXPR.

Added:
    trunk/gcc/testsuite/g++.dg/init/aggr7.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/semantics.c
    trunk/gcc/cp/typeck2.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/41449] Partial aggregate initialization not cleaned up on exception
       [not found] <bug-41449-4@http.gcc.gnu.org/bugzilla/>
  2011-10-20 18:58 ` jason at gcc dot gnu.org
  2011-10-20 19:14 ` jason at gcc dot gnu.org
@ 2011-10-20 19:19 ` jason at gcc dot gnu.org
  2011-10-25 18:24 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-20 19:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41449

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-20 19:18:56 UTC ---
Fixed for 4.7.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/41449] Partial aggregate initialization not cleaned up on exception
       [not found] <bug-41449-4@http.gcc.gnu.org/bugzilla/>
  2011-10-20 18:58 ` jason at gcc dot gnu.org
@ 2011-10-20 19:14 ` jason at gcc dot gnu.org
  2011-10-20 19:19 ` jason at gcc dot gnu.org
  2011-10-25 18:24 ` jason at gcc dot gnu.org
  3 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-20 19:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41449

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-10-20 19:13:54 UTC ---
Author: jason
Date: Thu Oct 20 19:13:51 2011
New Revision: 180267

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180267
Log:
    PR c++/41449
    * typeck2.c (split_nonconstant_init_1): Handle EH cleanup of
    initialized subobjects.

Added:
    trunk/gcc/testsuite/g++.dg/eh/partial1.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/typeck2.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/41449] Partial aggregate initialization not cleaned up on exception
       [not found] <bug-41449-4@http.gcc.gnu.org/bugzilla/>
@ 2011-10-20 18:58 ` jason at gcc dot gnu.org
  2011-10-20 19:14 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2011-10-20 18:58 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41449

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] 7+ messages in thread

end of thread, other threads:[~2011-10-25 18:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-23 15:55 [Bug c++/41449] New: Partial aggregate initialization not cleaned up on exception jason at gcc dot gnu dot org
2009-09-23 15:55 ` [Bug c++/41449] " jason at gcc dot gnu dot org
2009-12-15  4:03 ` jason at gcc dot gnu dot org
     [not found] <bug-41449-4@http.gcc.gnu.org/bugzilla/>
2011-10-20 18:58 ` jason at gcc dot gnu.org
2011-10-20 19:14 ` jason at gcc dot gnu.org
2011-10-20 19:19 ` jason at gcc dot gnu.org
2011-10-25 18:24 ` 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).