From 7fd4402a22cfd0bc4be2fcd7ded9628eff711e26 Mon Sep 17 00:00:00 2001 From: Petr Pucil Date: Thu, 4 Apr 2024 10:36:02 +0200 Subject: [PATCH] C++: accept non-null `_root` arg in the top-level type Fixes the NavRootRecursive test for `cpp_stl_11` and `cpp_stl_98` - see https://github.com/kaitai-io/kaitai_struct_tests/commit/5941262e78 --- .../src/main/scala/io/kaitai/struct/languages/CppCompiler.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala b/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala index ad459a0a8..05ef8e7c3 100644 --- a/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala +++ b/shared/src/main/scala/io/kaitai/struct/languages/CppCompiler.scala @@ -199,7 +199,7 @@ class CppCompiler( handleAssignmentSimple(ParentIdentifier, pParent) handleAssignmentSimple(RootIdentifier, if (name == rootClassName) { - "this" + s"${pRoot} ? ${pRoot} : this" } else { pRoot })