public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "msadoghi at ca dot ibm dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/20040] New: A new expression must check the access level of delete operator Date: Fri, 18 Feb 2005 04:11:00 -0000 [thread overview] Message-ID: <20050217212130.20040.msadoghi@ca.ibm.com> (raw) Sourc code for t.cpp: ------------------------------------------------ class X { void operator delete(void *p) throw (); }; X xa; void X::operator delete(void *p) throw () { } int mymain() { X *p = new X; /* error - can't access X::operator delete */ return 0; } ------------------------------------------------ Expected Behaviour: ------------------------------------------------ t.cpp:9: `static void X::operator delete(void*)' is private t.cpp:14: within this context ------------------------------------------------ Actual Behaviour: ------------------------------------------------ None. ------------------------------------------------ t.ii generated with -save-temps option ------------------------------------------------ # 1 "t.cpp" # 1 "t.cpp" # 1 "<built-in>" # 1 "<command line>" # 1 "t.cpp" class X { void operator delete(void *p) throw (); }; X xa; void X::operator delete(void *p) throw () { } int mymain() { X *p = new X; return 0; } ------------------------------------------------ Release: ------------------------------------------------ GCC Version: 3.2.0 ------------------------------------------------ Environment: System Type: ------------------------------------------------ Reading specs from /usr/local/bin/../lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.2/specs Configured with: /scratch/gcc-3.2/configure --prefix=/usr/local/gcc.3.2.0 --enable-threads=aix --disable-nls Thread model: aix gcc version 3.2 /usr/local/bin/../lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.2/cpp0 -lang-c++ -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -v -iprefix /usr/local/bin/../lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.2/ -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -D_IBMR2 -D_POWER -D_LONG_LONG -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_IBMR2 -D_POWER -D_LONG_LONG -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -Asystem=unix -Asystem=aix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 -D_LARGE_FILE_API -D_ALL_SOURCE -D__WCHAR_TYPE__=short unsigned int -D_ARCH_COM /home/msadoghi/scenario/common/t.cpp t.ii GNU CPP version 3.2 (cpplib) ignoring nonexistent directory "/usr/local/lib/gcc-lib/../../powerpc-ibm-aix5.1.0.0/include" ignoring nonexistent directory "/usr/local/gcc.3.2.0/powerpc-ibm-aix5.1.0.0/include" ignoring duplicate directory "/usr/local/gcc.3.2.0/include/c++/3.2" ignoring duplicate directory "/usr/local/gcc.3.2.0/include/c++/3.2/powerpc-ibm-aix5.1.0.0" ignoring duplicate directory "/usr/local/gcc.3.2.0/include/c++/3.2/backward" ignoring duplicate directory "/usr/local/gcc.3.2.0/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.2/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc-lib/../../include/c++/3.2 /usr/local/lib/gcc-lib/../../include/c++/3.2/powerpc-ibm-aix5.1.0.0 /usr/local/lib/gcc-lib/../../include/c++/3.2/backward /usr/local/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.2/include /usr/local/include /usr/local/gcc.3.2.0/include /usr/include End of search list. /usr/local/bin/../lib/gcc-lib/powerpc-ibm-aix5.1.0.0/3.2/cc1plus -fpreprocessed t.ii -quiet -dumpbase t.cpp -version -o t.s GNU CPP version 3.2 (cpplib) GNU C++ version 3.2 (powerpc-ibm-aix5.1.0.0) compiled by GNU C version 3.2. /home/msadoghi/scenario/common/t.cpp:2: warning: all member functions in class `X' are private as -u -mcom -o t.o t.s ------------------------------------------------ How-To-Repeat: ------------------------------------------------ g++ -v -save-temps -c -std=iso9899:199409 t.cpp ------------------------------------------------ Note: ------------------------------------------------ This is a diagnostic test case. Compilation failure is expected. However the compilation is successful and no error or warning messages are produced. According to C++ ANSI Standard the test cases should produces an error. Therefore, in the strict mode compiler should produce a server error and in the extended mode it should at least produces a warning. C++ ANSI Standard: "new-expression that creates object of class type or array thereof must check access for allocation function, deallocation function, and constructor this checks access for operator delete" AIX, MACOS and LINUX all have a similar behaviors. ------------------------------------------------ -- Summary: A new expression must check the access level of delete operator Product: gcc Version: 3.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: msadoghi at ca dot ibm dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20040
next reply other threads:[~2005-02-17 21:21 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-02-18 4:11 msadoghi at ca dot ibm dot com [this message] 2005-02-18 4:12 ` [Bug c++/20040] " pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20050217212130.20040.msadoghi@ca.ibm.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).