public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/54812] New: [C++11] Delete expression doesn't respect access of defaulted destructor
@ 2012-10-04 14:37 daniel.kruegler at googlemail dot com
  2012-10-05 20:53 ` [Bug c++/54812] " paolo.carlini at oracle dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-10-04 14:37 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 54812
           Summary: [C++11] Delete expression doesn't respect access of
                    defaulted destructor
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com
                CC: paolo@gcc.gnu.org


While working on a further simplification of the is_constructible traits using
gcc 4.8.0 20120930 (experimental) with the compiler flags

-Wall -pedantic -std=c++11

the following program demonstrates that private access of a *defaulted*
destructor is not properly respected during delete expressions:

//--------------------
#include <new>

template<class T>
T&& declval();

struct P1 {
private:
  ~P1();
};

struct P2 {
  ~P2() = delete;
};

struct P3 {
private:
  ~P3() = default;
};

typedef decltype(::delete declval<P1*>()) t1;  // #20
typedef decltype(::delete declval<P2*>()) t2;  // #21
typedef decltype(::delete declval<P3*>()) t3;  // #22 *Not* detected
//--------------------

This program produces only two errors instead of the expected three:

"main.cpp|8|error: 'P1::~P1()' is private|
 main.cpp|20|error: within this context|
 main.cpp|21|error: use of deleted function 'P2::~P2()'|
 main.cpp|12|error: declared here|
"

According to [expr.delete] p10 access control shall be done for the destructor.


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

end of thread, other threads:[~2014-05-06 21:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-04 14:37 [Bug c++/54812] New: [C++11] Delete expression doesn't respect access of defaulted destructor daniel.kruegler at googlemail dot com
2012-10-05 20:53 ` [Bug c++/54812] " paolo.carlini at oracle dot com
2012-10-05 21:00 ` daniel.kruegler at googlemail dot com
2012-10-05 21:08 ` paolo.carlini at oracle dot com
2012-10-05 21:10 ` paolo.carlini at oracle dot com
2012-10-05 23:26 ` paolo.carlini at oracle dot com
2012-10-06  8:12 ` daniel.kruegler at googlemail dot com
2013-05-30 20:40 ` jason at gcc dot gnu.org
2013-06-12 11:32 ` redi at gcc dot gnu.org
2013-07-26 12:34 ` redi at gcc dot gnu.org
2013-07-26 12:35 ` redi at gcc dot gnu.org
2013-07-26 12:38 ` paolo.carlini at oracle dot com
2014-05-06 21:56 ` 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).