public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57930] New: missing destructor call after thrown exception in C++11 list initialization
@ 2013-07-18 20:20 mmehlich at semanticdesigns dot com
  2013-07-18 23:59 ` [Bug c++/57930] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mmehlich at semanticdesigns dot com @ 2013-07-18 20:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57930
           Summary: missing destructor call after thrown exception in
                    C++11 list initialization
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mmehlich at semanticdesigns dot com

In the example below, a subobject of type B is constructed but not destructed
when an exception is thrown during construction of the enclosing object of
type A after subobject of type B has been constructed.

extern "C" int printf(const char *,...);
struct B {
    B(int,int) { printf("CB %p\n",this); }
    B(const B&) { printf("const CB %pn\n",this); }
    B(B&&) { printf("const CB %pn\n",this); }
    ~B() { printf("B %p\n",this);  }
};
struct C {
    int c;
    int c2;
};
struct A {
     struct B b;
     struct C c;
};
A test() {
    //const A a1 = { { 1, 2 }, { 3, (throw 9, 4) } } ; // destructor for B
called
    //const A &a2 = { { 1, 2 }, { 3, (throw 9, 4) } } ; // destructor for B not
called
    return { { 1, 2 }, { 3, (throw 9, 4) } } ; // destructor for B not called
};
int main() {
    try {
        test();
    } catch (...) {
    }
}


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

* [Bug c++/57930] missing destructor call after thrown exception in C++11 list initialization
  2013-07-18 20:20 [Bug c++/57930] New: missing destructor call after thrown exception in C++11 list initialization mmehlich at semanticdesigns dot com
@ 2013-07-18 23:59 ` redi at gcc dot gnu.org
  2013-07-22 10:15 ` paolo.carlini at oracle dot com
  2013-07-22 10:42 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2013-07-18 23:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I'm pretty sure there's an existing bug report about this, opened by Jason.


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

* [Bug c++/57930] missing destructor call after thrown exception in C++11 list initialization
  2013-07-18 20:20 [Bug c++/57930] New: missing destructor call after thrown exception in C++11 list initialization mmehlich at semanticdesigns dot com
  2013-07-18 23:59 ` [Bug c++/57930] " redi at gcc dot gnu.org
@ 2013-07-22 10:15 ` paolo.carlini at oracle dot com
  2013-07-22 10:42 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-22 10:15 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwakely.gcc at gmail dot com

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Maybe we have another one too, but isn't this PR57510?


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

* [Bug c++/57930] missing destructor call after thrown exception in C++11 list initialization
  2013-07-18 20:20 [Bug c++/57930] New: missing destructor call after thrown exception in C++11 list initialization mmehlich at semanticdesigns dot com
  2013-07-18 23:59 ` [Bug c++/57930] " redi at gcc dot gnu.org
  2013-07-22 10:15 ` paolo.carlini at oracle dot com
@ 2013-07-22 10:42 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2013-07-22 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes, that's probably the one I'm thinking of.

*** This bug has been marked as a duplicate of bug 57510 ***


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

end of thread, other threads:[~2013-07-22 10:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-18 20:20 [Bug c++/57930] New: missing destructor call after thrown exception in C++11 list initialization mmehlich at semanticdesigns dot com
2013-07-18 23:59 ` [Bug c++/57930] " redi at gcc dot gnu.org
2013-07-22 10:15 ` paolo.carlini at oracle dot com
2013-07-22 10:42 ` redi 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).