April 01, 2004
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


April 02, 2004
"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