diff --git a/src/language/templates/ast/ast.cpp b/src/language/templates/ast/ast.cpp index d2f7591b87..ab68e49b48 100644 --- a/src/language/templates/ast/ast.cpp +++ b/src/language/templates/ast/ast.cpp @@ -73,10 +73,6 @@ void Ast::set_parent(Ast* p) { parent = p; } -void Ast::set_parent_in_children() { - throw std::runtime_error("set_parent_in_children not implemented"); -} - {% for node in nodes %} diff --git a/src/language/templates/ast/ast.hpp b/src/language/templates/ast/ast.hpp index e70d98b03c..a8378df45a 100644 --- a/src/language/templates/ast/ast.hpp +++ b/src/language/templates/ast/ast.hpp @@ -348,14 +348,6 @@ struct Ast: public std::enable_shared_from_this { * \ref Check Ast::parent for more information */ virtual void set_parent(Ast* p); - - /** - *\brief Set this object as parent for all the children - * - * This should be called in every object (with children) constructor - * to set the parents. - */ - virtual void set_parent_in_children(); }; /** @} */ // end of ast_class @@ -714,12 +706,15 @@ struct Ast: public std::enable_shared_from_this { {% endif %} {% if node.children %} + private: /** - * \brief Set parents in children + *\brief Set this object as parent for all the children * - * Usually called in constructors + * This should be called in every object (with children) constructor + * to set parents. Since it is called only in the constructors it + * should not be virtual to avoid ambiguities (issue #295). */ - virtual void set_parent_in_children() override; + void set_parent_in_children(); {% endif %} };