public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/46910] New: std::shared_ptr requires public destructor for a class with friend deleter
@ 2010-12-12 16:50 gccbugzilla at virginmedia dot com
  2010-12-12 16:54 ` [Bug libstdc++/46910] " gccbugzilla at virginmedia dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gccbugzilla at virginmedia dot com @ 2010-12-12 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: std::shared_ptr requires public destructor for a class
                    with friend deleter
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gccbugzilla@virginmedia.com


Created attachment 22726
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22726
Code example and compiler output

class TestA
{
public:
  static std::shared_ptr<TestA> CreateTestA();

private:
  TestA();
  ~TestA();

private:
  class Deleter;
  friend class Deleter;

};

class TestA::Deleter
{
public:
  void operator()( TestA * p)
  {
    std::cout << "Deleting TestA\n";
    delete p;
  }
};

std::shared_ptr<TestA> TestA::CreateTestA()
{
  return std::shared_ptr<TestA>(
                                new TestA(),
                                TestA::Deleter()
                                );
}
will not compile:
error: ‘TestA::~TestA()’ is private

The boost shared_ptr works OK.


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

end of thread, other threads:[~2010-12-14 22:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-12 16:50 [Bug libstdc++/46910] New: std::shared_ptr requires public destructor for a class with friend deleter gccbugzilla at virginmedia dot com
2010-12-12 16:54 ` [Bug libstdc++/46910] " gccbugzilla at virginmedia dot com
2010-12-12 17:35 ` paolo.carlini at oracle dot com
2010-12-12 18:10 ` redi at gcc dot gnu.org
2010-12-12 19:19 ` paolo.carlini at oracle dot com
2010-12-14 22:13 ` redi at gcc dot gnu.org
2010-12-14 22:14 ` 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).