www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Non-conformance with deleting pointer to incomplete type

↑ ↓ ← "Jonathan Turkanis" <technews kangaroologic.com> writes:
Hi,

The following program causes a compiler error (8.38n):

    struct T;

    T* CreateT();

    int main()
    {
        delete CreateT();
    }

According 5.3.5/5, deleting a pointer to an incomplete type yields
undefined behavior only if the complete type has a non-trivial
destructor or deallocation function, so a compile error seems
inappropriate here. All compilers I have tested except GCC and
DigitalMars just give a warning.

Jonathan
Apr 01 2004
↑ ↓ → "Jonathan Turkanis" <technews kangaroologic.com> writes:
"Jonathan Turkanis" <technews kangaroologic.com> wrote in message
news:c4ghig$1uk3$1 digitaldaemon.com...
 Hi,

 inappropriate here. All compilers I have tested except GCC and
 DigitalMars just give a warning.

I just verified that GCC downgraded the diagnostic from an error to a warning with version 3.3. Best Regards, Jonathan
Apr 01 2004