===================================================================
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+template<class T> class shared_ptr
+{
+public:
+ shared_ptr( T * p ) { }
+};
+
+class BuildingCompletedEvent
+{
+public:
+ __attribute__((transaction_callable)) void updateBuildingSite(void);
+};
+
+void
+BuildingCompletedEvent::updateBuildingSite()
+{
+ shared_ptr<BuildingCompletedEvent> event(new BuildingCompletedEvent());
+}
===================================================================
@@ -2004,7 +2004,21 @@ build_tm_store (location_t loc, tree lhs
simple_type = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (TREE_TYPE (fn))));
- if (!useless_type_conversion_p (simple_type, type))
+ if (TREE_CODE (rhs) == CONSTRUCTOR)
+ {
+ /* Handle the easy initialization to zero. */
+ if (CONSTRUCTOR_ELTS (rhs) == 0)
+ rhs = integer_zero_node;
+ else
+ {
+ /* ...otherwise punt to the caller and probably use
+ BUILT_IN_TM_MEMMOVE, because we can't wrap a
+ VIEW_CONVERT_EXPR around a CONSTRUCTOR (below) and produce
+ valid gimple. */
+ return NULL;
+ }
+ }
+ else if (!useless_type_conversion_p (simple_type, type))
{
gimple g;
tree temp;