* call.c (build_op_delete_call): Tweak error.

From-SVN: r154073
This commit is contained in:
Jason Merrill 2009-11-10 13:31:22 -05:00 committed by Jason Merrill
parent 58926110dc
commit 1e7999555e
4 changed files with 30 additions and 4 deletions

View File

@ -1,4 +1,6 @@
2009-11-09 Jason Merrill <jason@redhat.com>
2009-11-10 Jason Merrill <jason@redhat.com>
* call.c (build_op_delete_call): Tweak error.
PR c++/34158
PR c++/36406
@ -8,6 +10,8 @@
* pt.c (primary_template_instantiation_p): Non-static.
* cp-tree.h: Declare it.
2009-11-09 Jason Merrill <jason@redhat.com>
PR c++/41972
* parser.c (cp_parser_template_argument): Accept SCOPE_REF around
VAR_DECL.

View File

@ -4613,8 +4613,10 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
deallocation function, would have been selected as a match for the
allocation function, the program is ill-formed." */
if (non_placement_deallocation_fn_p (fn))
error ("non-placement deallocation function %qD selected for "
"placement delete", fn);
{
error ("non-placement deallocation function %q+D", fn);
error ("selected for placement delete");
}
}
else
/* "Any non-placement deallocation function matches a non-placement

View File

@ -1,4 +1,6 @@
2009-11-09 Jason Merrill <jason@redhat.com>
2009-11-10 Jason Merrill <jason@redhat.com>
* g++.dg/init/placement5.C: New.
PR c++/34158
* g++.dg/init/placement4.C: New.

View File

@ -0,0 +1,18 @@
// 5.3.4/19: If the lookup finds the two-parameter form of a usual
// deallocation function (3.7.4.2) and that function, considered as a
// placement deallocation function, would have been selected as a match for
// the allocation function, the program is ill-formed.
typedef __SIZE_TYPE__ size_t;
struct A
{
A();
static void* operator new (size_t, size_t);
static void operator delete (void *, size_t); // { dg-error "non-placement" }
};
int main()
{
A* ap = new (24) A; // { dg-error "placement delete" }
}