OSDN Git Service

* call.c (build_op_delete_call): Tweak error.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Nov 2009 18:31:22 +0000 (18:31 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 10 Nov 2009 18:31:22 +0000 (18:31 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154073 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/placement5.C [new file with mode: 0644]

index 6087ed7..2407446 100644 (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.
index 1cd3fc2..efee604 100644 (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
index ae1202f..0267ed4 100644 (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.
diff --git a/gcc/testsuite/g++.dg/init/placement5.C b/gcc/testsuite/g++.dg/init/placement5.C
new file mode 100644 (file)
index 0000000..bb88239
--- /dev/null
@@ -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" }
+}