Skip to content

Commit

Permalink
[cpp] Fix typing of underlying type for abstracts
Browse files Browse the repository at this point in the history
  • Loading branch information
vonagam committed Jun 6, 2020
1 parent 7a3f246 commit badb0a2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/generators/gencpp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 () ->
Expand Down
18 changes: 18 additions & 0 deletions tests/unit/src/unit/issues/Issue9542.hx
Original file line number Diff line number Diff line change
@@ -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<Int>) from cpp.Reference<Int> {}

#else
class Issue9542 extends unit.Test {}
#end

0 comments on commit badb0a2

Please sign in to comment.