diff --git a/src/generators/gencpp.ml b/src/generators/gencpp.ml index 590f6221acb..18a71aa903b 100644 --- a/src/generators/gencpp.ml +++ b/src/generators/gencpp.ml @@ -1749,7 +1749,7 @@ let rec cpp_type_of stack ctx haxe_type = | TAbstract (abs,pl) when not (Meta.has Meta.CoreType abs.a_meta) -> cpp_type_from_path stack ctx abs.a_path pl (fun () -> - cpp_type_of stack ctx (Abstract.get_underlying_type abs pl) ) + cpp_type_of stack ctx (Abstract.get_underlying_type ~return_first:true abs pl) ) | TAbstract (a,params) -> cpp_type_from_path stack ctx a.a_path params (fun () -> diff --git a/tests/unit/src/unit/issues/Issue9542.hx b/tests/unit/src/unit/issues/Issue9542.hx new file mode 100644 index 00000000000..ea259b6ce6b --- /dev/null +++ b/tests/unit/src/unit/issues/Issue9542.hx @@ -0,0 +1,18 @@ +package unit.issues; +#if (cpp && !cppia) + +class Issue9542 extends unit.Test { + @:analyzer(no_optimize) + function test() { + var foo = 0; + var bar: Bar = foo; + foo += 1; + eq(bar, 1); + } +} + +private abstract Bar(cpp.Reference) from cpp.Reference {} + +#else +class Issue9542 extends unit.Test {} +#end