[Bug c++/43452] Array delete causes error on incomplete type

2014-04-16 Thread redi at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43452

Jonathan Wakely redi at gcc dot gnu.org changed:

   What|Removed |Added

 CC||tilman.vogel at web dot de

--- Comment #8 from Jonathan Wakely redi at gcc dot gnu.org ---
*** Bug 58114 has been marked as a duplicate of this bug. ***


[Bug c++/43452] Array delete causes error on incomplete type

2013-09-09 Thread paolo at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43452

--- Comment #5 from paolo at gcc dot gnu.org paolo at gcc dot gnu.org ---
Author: paolo
Date: Mon Sep  9 14:31:16 2013
New Revision: 202404

URL: http://gcc.gnu.org/viewcvs?rev=202404root=gccview=rev
Log:
2013-09-09  Paolo Carlini  paolo.carl...@oracle.com

PR c++/43452
* doc/invoke.texi (-Wdelete-incomplete): Document it.

/c-family
2013-09-09  Paolo Carlini  paolo.carl...@oracle.com

PR c++/43452
* c.opt (Wdelete-incomplete): Add.

/cp
2013-09-09  Paolo Carlini  paolo.carl...@oracle.com

PR c++/43452
* init.c (build_vec_delete_1): When the type is incomplete emit a
warning, enabled by default (not an error).
(build_delete): Adjust to use OPT_Wdelete_incomplete.

/testsuite
2013-09-09  Paolo Carlini  paolo.carl...@oracle.com

PR c++/43452
* g++.dg/warn/Wdelete-incomplete-1.C: New.
* g++.dg/warn/Wdelete-incomplete-2.C: Likewise.
* g++.dg/init/delete1.C: Adjust.

Added:
trunk/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-1.C
trunk/gcc/testsuite/g++.dg/warn/Wdelete-incomplete-2.C
Modified:
trunk/gcc/ChangeLog
trunk/gcc/c-family/ChangeLog
trunk/gcc/c-family/c.opt
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/init.c
trunk/gcc/doc/invoke.texi
trunk/gcc/testsuite/g++.dg/init/delete1.C


[Bug c++/43452] Array delete causes error on incomplete type

2013-09-09 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43452

Paolo Carlini paolo.carlini at oracle dot com changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |FIXED
   Target Milestone|--- |4.9.0

--- Comment #6 from Paolo Carlini paolo.carlini at oracle dot com ---
Fixed for 4.9.0.


[Bug c++/43452] Array delete causes error on incomplete type

2013-09-09 Thread paolo at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43452

--- Comment #7 from paolo at gcc dot gnu.org paolo at gcc dot gnu.org ---
Author: paolo
Date: Mon Sep  9 14:47:21 2013
New Revision: 202405

URL: http://gcc.gnu.org/viewcvs?rev=202405root=gccview=rev
Log:
2013-09-09  Paolo Carlini  paolo.carl...@oracle.com

PR c++/43452
* doc/invoke.texi (-Wdelete-incomplete): Document it.

/c-family
2013-09-09  Paolo Carlini  paolo.carl...@oracle.com

PR c++/43452
* c.opt (Wdelete-incomplete): Add.

/cp
2013-09-09  Paolo Carlini  paolo.carl...@oracle.com

PR c++/43452
* init.c (build_vec_delete_1): When the type is incomplete emit a
warning, enabled by default (not an error).
(build_delete): Adjust to use OPT_Wdelete_incomplete.

/testsuite
2013-09-09  Paolo Carlini  paolo.carl...@oracle.com

PR c++/43452
* g++.dg/warn/Wdelete-incomplete-1.C: New.
* g++.dg/warn/Wdelete-incomplete-2.C: Likewise.
* g++.dg/init/delete1.C: Adjust.

Modified:
trunk/gcc/testsuite/ChangeLog


[Bug c++/43452] Array delete causes error on incomplete type

2013-09-05 Thread paolo.carlini at oracle dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43452

Paolo Carlini paolo.carlini at oracle dot com changed:

   What|Removed |Added

 CC|gcc-bugs at gcc dot gnu.org|
   Assignee|unassigned at gcc dot gnu.org  |paolo.carlini at oracle 
dot com

--- Comment #4 from Paolo Carlini paolo.carlini at oracle dot com ---
Let's resolve this.


[Bug c++/43452] Array delete causes error on incomplete type

2010-03-20 Thread bangerth at gmail dot com


--- Comment #3 from bangerth at gmail dot com  2010-03-20 11:26 ---
(In reply to comment #2)
 class Foo;
 Foo* f();
 int main() {
Foo* p = f();
delete [] p;
 }

I can't see how the compiler could possibly do anything useful in this case
if Foo is incomplete. I can't find any statement that would say that the code
is ill-formed, however.

If there really is no such statement, I still don't think we should make it a
priority to compile this code without an error.

W.


-- 

bangerth at gmail dot com changed:

   What|Removed |Added

 CC||bangerth at gmail dot com


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



[Bug c++/43452] Array delete causes error on incomplete type

2010-03-19 Thread redi at gcc dot gnu dot org


--- Comment #1 from redi at gcc dot gnu dot org  2010-03-20 00:57 ---
It's undefined behaviour


-- 


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



[Bug c++/43452] Array delete causes error on incomplete type

2010-03-19 Thread redi at gcc dot gnu dot org


--- Comment #2 from redi at gcc dot gnu dot org  2010-03-20 01:03 ---
Hmm, on second thoughts...
Technically that program has undefined behaviour because p does not have a
value that comes from a previous new expression, however this variation is not
undefined as long as Foo has a trivial destructor, and f returns a pointer to
an array of Foo:

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


-- 


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