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
* [Bug libstdc++/46910] std::shared_ptr requires public destructor for a class with friend deleter 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 ` gccbugzilla at virginmedia dot com 2010-12-12 17:35 ` paolo.carlini at oracle dot com ` (4 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: gccbugzilla at virginmedia dot com @ 2010-12-12 16:54 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46910 --- Comment #1 from Sam <gccbugzilla at virginmedia dot com> 2010-12-12 16:54:01 UTC --- gcc 4.5.1 and test code built on Linux 2.6.35-24-generic #42-Ubuntu SMP Thu Dec 2 02:41:37 UTC 2010 x86_64 GNU/Linux ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/46910] std::shared_ptr requires public destructor for a class with friend deleter 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 ` (3 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: paolo.carlini at oracle dot com @ 2010-12-12 17:35 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46910 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> 2010-12-12 17:35:21 UTC --- Jon, can you have a look? ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/46910] std::shared_ptr requires public destructor for a class with friend deleter 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 ` (2 subsequent siblings) 5 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2010-12-12 18:10 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46910 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2010.12.12 18:09:59 AssignedTo|unassigned at gcc dot |redi at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-12 18:09:59 UTC --- Created attachment 22727 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22727 do not derive Sp_counted_deleter from Sp_counted_ptr The problem is that the Sp_counted_deleter class inherits from Sp_counted_ptr so even though Sp_counter_ptr::_M_dispose is never called, it does get instantiated. I'm testing this patch ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/46910] std::shared_ptr requires public destructor for a class with friend deleter 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 ` (2 preceding siblings ...) 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 5 siblings, 0 replies; 7+ messages in thread From: paolo.carlini at oracle dot com @ 2010-12-12 19:19 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46910 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|jwakely.gcc at gmail dot | |com | --- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2010-12-12 19:19:02 UTC --- Many thanks! ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/46910] std::shared_ptr requires public destructor for a class with friend deleter 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 ` (3 preceding siblings ...) 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 5 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2010-12-14 22:13 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46910 --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-14 22:13:31 UTC --- Author: redi Date: Tue Dec 14 22:13:26 2010 New Revision: 167819 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167819 Log: 2010-12-14 Jonathan Wakely <jwakely.gcc@gmail.com> PR libstdc++/46910 * include/bits/shared_ptr_base.h (_Sp_counted_deleter): Do not derive from _Sp_counted_ptr. * testsuite/20_util/shared_ptr/cons/46910.cc: New. * testsuite/20_util/shared_ptr/cons/43820.cc: Adjust. * testsuite/20_util/weak_ptr/comparison/cmp_neg.cc: Adjust. Added: trunk/libstdc++-v3/testsuite/20_util/shared_ptr/cons/46910.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/bits/shared_ptr_base.h trunk/libstdc++-v3/testsuite/20_util/shared_ptr/cons/43820.cc trunk/libstdc++-v3/testsuite/20_util/weak_ptr/comparison/cmp_neg.cc ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug libstdc++/46910] std::shared_ptr requires public destructor for a class with friend deleter 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 ` (4 preceding siblings ...) 2010-12-14 22:13 ` redi at gcc dot gnu.org @ 2010-12-14 22:14 ` redi at gcc dot gnu.org 5 siblings, 0 replies; 7+ messages in thread From: redi at gcc dot gnu.org @ 2010-12-14 22:14 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46910 Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED Target Milestone|--- |4.6.0 --- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-12-14 22:14:15 UTC --- fixed for 4.6.0 ^ 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).