diff --git a/c-opast.cc b/c-opast.cc
index b5ea4da..0b60234 100644
--- a/c-opast.cc
+++ b/c-opast.cc
@@ -32,18 +32,24 @@ T_RootNode& A_Node::root( ) const noexcept
 			const_cast< A_Node* >( node ) );
 }
 
-void A_Node::replace(
+bool A_Node::replace(
 		A_Node const&		node ,
-		T_OwnPtr< A_Node >	replacement
+		T_OwnPtr< A_Node >&	replacement
 		) noexcept
 {
 	const auto nc{ size( ) };
 	for ( auto i = 0u ; i < nc ; i ++ ) {
 		if ( child( i ).get( ) == &node ) {
 			child( i ) = std::move( replacement );
-			return;
+			return true;
 		}
 	}
+	for ( auto i = 0u ; i < nc ; i ++ ) {
+		if ( child( i ) && child( i )->replace( node , replacement ) ) {
+			return true;
+		}
+	}
+	return false;
 }
 
 /*----------------------------------------------------------------------------*/
diff --git a/c-opast.hh b/c-opast.hh
index 9533ea7..a36707f 100644
--- a/c-opast.hh
+++ b/c-opast.hh
@@ -107,8 +107,8 @@ class A_Node
 			const uint32_t index ) noexcept
 		{ return children_[ index ]; }
 
-	void replace( A_Node const& node ,
-			T_OwnPtr< A_Node > replacement ) noexcept;
+	bool replace( A_Node const& node ,
+			T_OwnPtr< A_Node >& replacement ) noexcept;
 };
 
 // Browser function to be used with T_Visitor
diff --git a/c-opopt.cc b/c-opopt.cc
index 8f37d26..06679a8 100644
--- a/c-opopt.cc
+++ b/c-opopt.cc
@@ -1461,9 +1461,11 @@ void CPReplaceWithConstant_(
 		}
 
 		auto& p{ eid.parent( ) };
-		auto replacement{ NewOwned< T_ConstantExprNode >( p , value ) };
+		T_OwnPtr< A_Node > replacement{
+			NewOwned< T_ConstantExprNode >( p , value )
+		};
 		replacement->location( ) = eid.location( );
-		p.replace( eid , std::move( replacement ) );
+		p.replace( eid , replacement );
 		oData.logger( [&]() {
 			T_StringBuilder sb;
 			sb << "Propagated constant from " << var.name
diff --git a/test/build.srd b/test/build.srd
index bd62872..d58c2ea 100644
--- a/test/build.srd
+++ b/test/build.srd
@@ -5,7 +5,7 @@
 	)
 	(optimizer on
 		(constant-folding on
-			# (fixed-resolution on)
+			(fixed-resolution on)
 		)
 		(constant-propagation on)
 	)