Issue 143: nme.Memory error in c++ code with --no-inline
Status:  Fixed
Owner: ----
Closed:  Feb 2012
Reported by lucadelt...@googlemail.com, Oct 6, 2011
gcc 4.6.1 if it makes any difference, latest nightly of haxe, and current svn of hxcpp and nme.


code:

package;
import nme.Memory;
class Main {
   static function main() {}
}


compiler options:

haxe -cp . -main Main -lib nme -cpp cpp --no-inline


errors: (from gcc)


./src/nme/Memory.cpp: In static member function ‘static Void nme::Memory_obj::select(nme::utils::ByteArray)’:
./src/nme/Memory.cpp:51:46: error: invalid initialization of non-const reference of type ‘Array<unsigned char>&’ from an rvalue of type ‘Array<unsigned char>’
/home/luca/hxcpp-svn/hxcpp-read-only//include/hx/StdLibs.h:127:13: error: in passing argument 1 of ‘void __hxcpp_memory_select(Array<unsigned char>&)’


error not present when 'not' using --no-inline... the clear issue being the 'need' for --no-inline to avoid other hxcpp issues.
Oct 7, 2011
#1 lucadelt...@googlemail.com
The issue would either be that haxe.io.Bytes compiles so that getData does not return a reference; but this seems not to be in error since Array is an object wrapping the actual real array.

So the fix which works is to change line 127 of include/hx/StdLibs.h to 'not' expect a reference type and compilation and running of program is correct.
Feb 8, 2012
Project Member #2 gameh...@gmail.com
This should now be fixed.
Status: Fixed