public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/36949]  New: [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count
@ 2008-07-27 15:48 d dot frey at gmx dot de
  2008-07-27 16:20 ` [Bug libstdc++/36949] " d dot frey at gmx dot de
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: d dot frey at gmx dot de @ 2008-07-27 15:48 UTC (permalink / raw)
  To: gcc-bugs

Here's a minimalistic example:

#include <memory>

struct A : std::enable_shared_from_this< A > {};

int main()
{
  std::make_shared< A >()->shared_from_this();
}

It throws a bad_weak_ptr exception, which is AFAICT wrong.


-- 
           Summary: [C++0x] make_shared does not initialize
                    enable_shared_from_this' internal shared_count
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: d dot frey at gmx dot de


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


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

* [Bug libstdc++/36949] [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count
  2008-07-27 15:48 [Bug libstdc++/36949] New: [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count d dot frey at gmx dot de
@ 2008-07-27 16:20 ` d dot frey at gmx dot de
  2008-07-27 17:33 ` paolo dot carlini at oracle dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: d dot frey at gmx dot de @ 2008-07-27 16:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from d dot frey at gmx dot de  2008-07-27 16:19 -------
*** Bug 36950 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug libstdc++/36949] [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count
  2008-07-27 15:48 [Bug libstdc++/36949] New: [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count d dot frey at gmx dot de
  2008-07-27 16:20 ` [Bug libstdc++/36949] " d dot frey at gmx dot de
@ 2008-07-27 17:33 ` paolo dot carlini at oracle dot com
  2008-07-28 20:28 ` jwakely dot gcc at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-07-27 17:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2008-07-27 17:32 -------
Jonathan, can you have a look? If you can confirm the issue, is it just matter
of adding a call to __enable_shared_from_this_helper(_M_refcount, _M_ptr,
_M_ptr) to __shared_ptr(_Sp_make_shared_tag, _Alloc, _Args&&...) ??

PS: I'm going to adjust some arguments around from _Alloc to const _Alloc&...


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jwakely dot gcc at gmail dot
                   |                            |com, paolo dot carlini at
                   |                            |oracle dot com


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


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

* [Bug libstdc++/36949] [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count
  2008-07-27 15:48 [Bug libstdc++/36949] New: [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count d dot frey at gmx dot de
  2008-07-27 16:20 ` [Bug libstdc++/36949] " d dot frey at gmx dot de
  2008-07-27 17:33 ` paolo dot carlini at oracle dot com
@ 2008-07-28 20:28 ` jwakely dot gcc at gmail dot com
  2008-07-28 23:10 ` paolo dot carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jwakely dot gcc at gmail dot com @ 2008-07-28 20:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jwakely dot gcc at gmail dot com  2008-07-28 20:27 -------
(In reply to comment #2)
> Jonathan, can you have a look? If you can confirm the issue, is it just matter
> of adding a call to __enable_shared_from_this_helper(_M_refcount, _M_ptr,
> _M_ptr) to __shared_ptr(_Sp_make_shared_tag, _Alloc, _Args&&...) ??

Yes, that's the right fix.  

> PS: I'm going to adjust some arguments around from _Alloc to const _Alloc&...

Cool.

Thanks for catching this, Daniel.


-- 


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


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

* [Bug libstdc++/36949] [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count
  2008-07-27 15:48 [Bug libstdc++/36949] New: [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count d dot frey at gmx dot de
                   ` (2 preceding siblings ...)
  2008-07-28 20:28 ` jwakely dot gcc at gmail dot com
@ 2008-07-28 23:10 ` paolo dot carlini at oracle dot com
  2008-07-28 23:29 ` paolo at gcc dot gnu dot org
  2008-07-28 23:31 ` paolo dot carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-07-28 23:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paolo dot carlini at oracle dot com  2008-07-28 23:09 -------
Thanks, fix forthcoming.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |paolo dot carlini at oracle
                   |dot org                     |dot com
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-07-28 23:09:43
               date|                            |


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


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

* [Bug libstdc++/36949] [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count
  2008-07-27 15:48 [Bug libstdc++/36949] New: [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count d dot frey at gmx dot de
                   ` (3 preceding siblings ...)
  2008-07-28 23:10 ` paolo dot carlini at oracle dot com
@ 2008-07-28 23:29 ` paolo at gcc dot gnu dot org
  2008-07-28 23:31 ` paolo dot carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu dot org @ 2008-07-28 23:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from paolo at gcc dot gnu dot org  2008-07-28 23:29 -------
Subject: Bug 36949

Author: paolo
Date: Mon Jul 28 23:28:16 2008
New Revision: 138219

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138219
Log:
2008-07-28  Paolo Carlini  <paolo.carlini@oracle.com>

        PR libstdc++/36949
        * include/tr1_impl/boost_shared_ptr.h
        (__shared_ptr(_Sp_make_shared_tag, _Alloc, _Args&&...): Call
        __enable_shared_from_this_helper.
        * testsuite/20_util/shared_ptr/creation/36949.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/20_util/shared_ptr/creation/36949.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/tr1_impl/boost_shared_ptr.h


-- 


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


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

* [Bug libstdc++/36949] [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count
  2008-07-27 15:48 [Bug libstdc++/36949] New: [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count d dot frey at gmx dot de
                   ` (4 preceding siblings ...)
  2008-07-28 23:29 ` paolo at gcc dot gnu dot org
@ 2008-07-28 23:31 ` paolo dot carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-07-28 23:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from paolo dot carlini at oracle dot com  2008-07-28 23:30 -------
Fixed.


-- 

paolo dot carlini at oracle dot com changed:

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


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


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

end of thread, other threads:[~2008-07-28 23:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-27 15:48 [Bug libstdc++/36949] New: [C++0x] make_shared does not initialize enable_shared_from_this' internal shared_count d dot frey at gmx dot de
2008-07-27 16:20 ` [Bug libstdc++/36949] " d dot frey at gmx dot de
2008-07-27 17:33 ` paolo dot carlini at oracle dot com
2008-07-28 20:28 ` jwakely dot gcc at gmail dot com
2008-07-28 23:10 ` paolo dot carlini at oracle dot com
2008-07-28 23:29 ` paolo at gcc dot gnu dot org
2008-07-28 23:31 ` paolo dot 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).