You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With "C:\cheerp\bin\clang++.exe" -target cheerp -cheerp-pretty-code -O0 a.cpp it's compiled to:
"use strict";/*Compiled using Cheerp (R) by Leaning Technologies Ltd*/var__imul=Math.imul;var__fround=Math.fround;varoSlot=0;varnullArray=[null];varnullObj={d:nullArray,o:0};function__ZN3FooC1Ei(Lthis,Lx){Lthis.i0=Lx;}function__Z7webMainv(){vartmp0=null;tmp0=new._Z3Foo(undefined);__ZN3FooC1Ei(tmp0,10);}function_memcpy(Ldst0,Mdst0,Lsrc0,Msrc0,Llen0){// omitted for the GitHub issue }__Z7webMainv();
Yes, we can reproduce this bug, we will let you know when it's fixed. In the mean time, as you found out, you can work around the problem by using a class with a public: before the first field. That's equivalent to a struct.
Example code:
With
"C:\cheerp\bin\clang++.exe" -target cheerp -cheerp-pretty-code -O0 a.cpp
it's compiled to:Note that there is syntax error:
However, if I just change
struct
toclass
, a valid JS is produced.My cheerp version is:
The text was updated successfully, but these errors were encountered: