re PR c++/29185 (inconsistent warning: deleting array)
/cp 2012-05-23 Paolo Carlini <paolo.carlini@oracle.com> PR c++/29185 * decl2.c (delete_sanity): Extend 'deleting array' warning to any array type. /testsuite 2012-05-23 Paolo Carlini <paolo.carlini@oracle.com> PR c++/29185 * g++.dg/warn/delete-array-1.C: New. From-SVN: r187801
This commit is contained in:
parent
9c09f152d9
commit
0a9696f022
|
@ -1,3 +1,9 @@
|
|||
2012-05-23 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/29185
|
||||
* decl2.c (delete_sanity): Extend 'deleting array' warning to
|
||||
any array type.
|
||||
|
||||
2012-05-21 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/51184
|
||||
|
|
|
@ -438,9 +438,8 @@ delete_sanity (tree exp, tree size, bool doing_vec, int use_global_delete,
|
|||
}
|
||||
|
||||
/* An array can't have been allocated by new, so complain. */
|
||||
if (TREE_CODE (exp) == VAR_DECL
|
||||
&& TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
|
||||
warning (0, "deleting array %q#D", exp);
|
||||
if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
|
||||
warning (0, "deleting array %q#E", exp);
|
||||
|
||||
t = build_expr_type_conversion (WANT_POINTER, exp, true);
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2012-05-23 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/29185
|
||||
* g++.dg/warn/delete-array-1.C: New.
|
||||
|
||||
2012-05-23 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* gcc.dg/torture/pr39074-2.c: Adjust.
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// PR c++/29185
|
||||
|
||||
int a [1];
|
||||
struct S { int a [1]; } s;
|
||||
|
||||
void foo (S *p)
|
||||
{
|
||||
delete a; // { dg-warning "deleting array" }
|
||||
delete s.a; // { dg-warning "deleting array" }
|
||||
delete p->a; // { dg-warning "deleting array" }
|
||||
}
|
Loading…
Reference in New Issue