From 97de678a87d8066b855d4791517fc327732e3ef4 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 20 Dec 2024 08:29:41 +0300 Subject: [PATCH] Test operator new(PointerFreeGC) of 'class gc' in treetest * tests/tree.cc (PTRFREE_GC): New macro (defined to `GC_NS_QUALIFY(PointerFreeGC)`). * tests/tree.cc (Tree::Tree): Use `new(PTRFREE_GC)Tree()` instead of `new(USE_GC)Tree()` if `depth` is 1. --- tests/tree.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/tree.cc b/tests/tree.cc index 318551f5a..51812a481 100644 --- a/tests/tree.cc +++ b/tests/tree.cc @@ -15,6 +15,7 @@ #include #include +#define PTRFREE_GC GC_NS_QUALIFY(PointerFreeGC) #define USE_GC GC_NS_QUALIFY(UseGC) class Tree; @@ -53,7 +54,8 @@ Tree::Tree(int a, int d) : arity(a), depth(d) #endif for (int i = 0; i < arity; i++) { GC_PTR_STORE_AND_DIRTY(&nodes[i].ptr, - new (USE_GC) Tree(arity, depth - 1)); + depth > 1 ? new (USE_GC) Tree(arity, depth - 1) + : new (PTRFREE_GC) Tree(arity, 0)); } } this->m_nodes = nodes;