Skip to content

Commit

Permalink
Test operator new(PointerFreeGC) of 'class gc' in treetest
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
ivmai committed Dec 20, 2024
1 parent abf3fc6 commit 97de678
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <stdio.h>
#include <stdlib.h>

#define PTRFREE_GC GC_NS_QUALIFY(PointerFreeGC)
#define USE_GC GC_NS_QUALIFY(UseGC)

class Tree;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 97de678

Please sign in to comment.