diff --git a/runtime/Cpp/runtime/src/tree/ParseTree.cpp b/runtime/Cpp/runtime/src/tree/ParseTree.cpp index 927e60979..4cec69d4d 100755 --- a/runtime/Cpp/runtime/src/tree/ParseTree.cpp +++ b/runtime/Cpp/runtime/src/tree/ParseTree.cpp @@ -33,6 +33,9 @@ using namespace antlr4::tree; +ParseTree::ParseTree() : parent(nullptr) { +} + bool ParseTree::operator == (const ParseTree &other) const { return &other == this; } diff --git a/runtime/Cpp/runtime/src/tree/ParseTree.h b/runtime/Cpp/runtime/src/tree/ParseTree.h index 8b772a9e3..b348ffa8f 100755 --- a/runtime/Cpp/runtime/src/tree/ParseTree.h +++ b/runtime/Cpp/runtime/src/tree/ParseTree.h @@ -45,6 +45,7 @@ namespace tree { // ml: This class unites 4 Java classes: RuleNode, ParseTree, SyntaxTree and Tree. class ANTLR4CPP_PUBLIC ParseTree { public: + ParseTree(); virtual ~ParseTree() {} /// The parent of this node. If the return value is null, then this @@ -102,7 +103,7 @@ namespace tree { class ANTLR4CPP_PUBLIC ParseTreeTracker { public: template - T* createInstance(Args ... args) { + T* createInstance(Args&& ... args) { static_assert(std::is_base_of::value, "Argument must be a parse tree type"); T* result = new T(args...); _allocated.push_back(result);