diff --git a/contributors.txt b/contributors.txt index c3b6eebe4..70ea141df 100644 --- a/contributors.txt +++ b/contributors.txt @@ -123,3 +123,4 @@ YYYY/MM/DD, github id, Full name, email 2016/11/25, MrSampson, Oliver Sampson, olsam@quickaudio.com 2016/11/29, millergarym, Gary Miller, miller.garym@gmail.com 2016/11/29, wxio, Gary Miller, gm@wx.io +2016/11/29, Naios, Denis Blank, naios@users.noreply.github.com diff --git a/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg b/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg index 07a90b91b..c5099c2fe 100644 --- a/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg +++ b/tool/resources/org/antlr/v4/tool/templates/codegen/Cpp/Cpp.stg @@ -1048,8 +1048,8 @@ virtual antlrcpp::Any accept(tree::ParseTreeVisitor *visitor) override; VisitorDispatchMethod(method) ::= << antlrcpp::Any ::::accept(tree::ParseTreeVisitor *visitor) { - if (dynamic_cast\<Visitor*>(visitor) != nullptr) - return ((Visitor *)visitor)->visit(this); + if (auto parserVisitor = dynamic_cast\<Visitor*>(visitor)) + return parserVisitor->visit(this); else return visitor->visitChildren(this); }