public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43452]  New: Array delete causes error on incomplete type
@ 2010-03-20  0:38 yy2bggggs at gmail dot com
  2010-03-20  0:57 ` [Bug c++/43452] " redi at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: yy2bggggs at gmail dot com @ 2010-03-20  0:38 UTC (permalink / raw)
  To: gcc-bugs

This code:

class Foo;
int main() {
   Foo* p;
   delete [] p;
}

Produces this error:
dt.cpp:6: error: invalid use of incomplete type `struct Foo'
dt.cpp:1: error: forward declaration of `struct Foo'

...but shouldn't it compile?
With:  g++ -c -std=c++98
...on 4.3.4 20090804 (release) 1 in Cygwin; and:
...on 4.1.2 20080704 (Red Hat 4.1.2-44)

The ordinary form works just fine; replace "delete [] p;" with "delete p;",
and:
dt.cpp: In function `int main()':
dt.cpp:6: warning: possible problem detected in invocation of delete operator:
dt.cpp:5: warning: `p' has incomplete type
dt.cpp:1: warning: forward declaration of `struct Foo'
dt.cpp:6: note: neither the destructor nor the class-specific operator delete
will be called, even if they are declared when the class is defined.
...on 4.3.4 20090804 system, and:
...on 4.1.2 20080704 system.


-- 
           Summary: Array delete causes error on incomplete type
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: yy2bggggs at gmail dot com
  GCC host triplet: 4.3.4


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


^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <bug-43452-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2014-04-16 16:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-20  0:38 [Bug c++/43452] New: Array delete causes error on incomplete type yy2bggggs at gmail dot com
2010-03-20  0:57 ` [Bug c++/43452] " redi at gcc dot gnu dot org
2010-03-20  1:03 ` redi at gcc dot gnu dot org
2010-03-20 11:27 ` bangerth at gmail dot com
     [not found] <bug-43452-4@http.gcc.gnu.org/bugzilla/>
2013-09-05 22:30 ` paolo.carlini at oracle dot com
2013-09-09 14:31 ` paolo at gcc dot gnu.org
2013-09-09 14:32 ` paolo.carlini at oracle dot com
2013-09-09 14:47 ` paolo at gcc dot gnu.org
2014-04-16 16:42 ` 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).