Index: testsuite/g++.dg/tm/pr46941.C
===================================================================
--- testsuite/g++.dg/tm/pr46941.C	(revision 0)
+++ testsuite/g++.dg/tm/pr46941.C	(revision 0)
@@ -0,0 +1,31 @@
+// { dg-do "compile" }
+// { dg-options "-fgnu-tm" }
+
+class Obj
+{ 
+  int dummy;
+};
+
+__attribute__((transaction_safe))
+Obj* allocate()
+{ 
+  return new Obj;
+}
+
+__attribute__((transaction_safe))
+void deallocate(Obj * o)
+{ 
+  delete o;
+}
+
+__attribute__((transaction_safe))
+Obj* allocatearray()
+{ 
+  return new Obj[2];
+}
+
+__attribute__((transaction_safe))
+void deallocatearray(Obj *o[])
+{ 
+  delete [] o;
+}
Index: cp/decl.c
===================================================================
--- cp/decl.c	(revision 168675)
+++ cp/decl.c	(working copy)
@@ -3775,6 +3775,8 @@ push_cp_library_fn (enum tree_code opera
 				 operator_code,
 				 type);
   pushdecl (fn);
+  if (flag_tm)
+    apply_tm_attr (fn, get_identifier ("transaction_pure"));
   return fn;
 }
 
