www.digitalmars.com         C & C++   DMDScript  

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

reply "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
Mar 31 2004
parent "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