My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 57: Problem with declaration of large Array of ints with concat in 2.06
2 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Aug 2010


 
Reported by beatofth...@gmail.com, Aug 15, 2010
Attached is a short sample file showing the issue. I am declaring an array which has a concat (this was developed this way as there used to be an issue in haXe several versions ago with declaring arrays with large number of elements).
The code compiles and runs fine with neko.

When I try to generate the C++ code, I get the following error:


./src/CPPV206Fails.cpp: In static member function ‘static void CPPV206Fails_obj::__boot()’:
./src/CPPV206Fails.cpp:103: error: ambiguous overload for ‘operator=’ in ‘hx::Static [with T = Array<int>](((Array<int>&)(& CPPV206Fails_obj::nbits_table))) = Array_obj<ELEM_>::concat(hx::ObjectPtr<Array_obj<ELEM_> >) [with ELEM_ = int](hx::ObjectPtr<Array_obj<int> >(((const hx::ObjectPtr<Array_obj<int> >&)((const hx::ObjectPtr<Array_obj<int> >*)(&((Array<int>*)Array_obj<ELEM_>::__new(int, int) [with ELEM_ = int](0).Array<ELEM_>::Add [with ELEM_ = int](((const int&)((const int*)(&8)))))->Array<int>::<anonymous>)))))’
/usr/lib/haxe/lib/hxcpp/2,06,0//include/Array.h:501: note: candidates are: Array<ELEM_>& Array<ELEM_>::operator=(Array<ELEM_>) [with ELEM_ = int]
/usr/lib/haxe/lib/hxcpp/2,06,0//include/Array.h:515: note:                 Array<ELEM_>& Array<ELEM_>::operator=(const Dynamic&) [with ELEM_ = int]
Called from ? line 1


This short sample was taken from my WavPack audio decoder code, which compiles/runs with no issues with haxe 2.04 - the following is the link to the full code if you would like to test or want to see the code in context.

http://www.wavpack.com/flash/v1.1_haxe_wavpack.zip

I'm using Ubuntu, haxe 2.06, my hxcpp is 1.0.5 [2.06.0]


CPPV206Fails.hx
1.3 KB   View   Download
Aug 15, 2010
#1 heinz.ho...@googlemail.com
the size doesn't matter, it only fails if it's a static variable

class Test
{
    static var a2:Array<Int>;

    public static function main()	
    {
		var a1:Array<Int> = [0].concat([8]); // works fine
		a2 = [0].concat([8]); // doesn't compile
    }
}
Aug 15, 2010
Project Member #2 gameh...@gmail.com
Fixed on hxcpp svn.
Status: Fixed
Aug 16, 2010
#3 beatofth...@gmail.com
I checked out the latest version from SVN, but my test program is still not compiling. I made sure to delete the directory from the previous (release) version of hxcpp etc.
I get the following error:

haxelib run hxcpp Build.xml haxe -Dcpp -Dhaxe_206 -Dtrue
gcc -c -fvisibility=hidden -O2 -DHX_LINUX -m32 -I/home/peter/Dev/haxe/hxcpp_svn//include -Iinclude -frtti ./src/CPPV206Fails.cpp -oobj/linux//src/CPPV206Fails.o
In file included from /home/peter/Dev/haxe/hxcpp_svn//include/hxcpp.h:219,
                 from ./src/CPPV206Fails.cpp:1:
/home/peter/Dev/haxe/hxcpp_svn//include/Array.h:544: error: default argument given for parameter 2 of ‘Array<T> Array_obj<ELEM_>::slice(int, Dynamic)’
/home/peter/Dev/haxe/hxcpp_svn//include/Array.h:318: error: after previous specification in ‘Array<T> Array_obj<ELEM_>::slice(int, Dynamic)’
Called from ? line 1
Called from BuildTool.hx line 899
Called from BuildTool.hx line 451
Called from BuildTool.hx line 475
Called from BuildTool.hx line 548
Called from BuildTool.hx line 581
Called from BuildTool.hx line 181
Uncaught exception - Error : 256 - build cancelled

Aug 18, 2010
#4 Andy.onthewings
The bug appear on Mac with latest SVN version. But it does not exist on Windows.
Aug 20, 2010
#5 Andy.onthewings
BTW my Mac config is 10.5.8 with i686-apple-darwin9-gcc-4.0.1.
Aug 22, 2010
#6 Andy.onthewings
Changing line 544 of hxcpp/include/Array.h from `Array<ELEM_> Array_obj<ELEM_>::slice(int inPos, Dynamic end = null())` to `Array<ELEM_> Array_obj<ELEM_>::slice(int inPos, Dynamic end)` fixes the error.

Powered by Google Project Hosting