Issue 131: function is not a member of object
Status:  Fixed
Owner: ----
Closed:  Aug 2011
Reported by michaelbaczynski@gmail.com, Jul 29, 2011
compile code below using latest haXe svn + hxcpp svn with: '-main Main -cpp bin'

compilation fails with:
./src/Heap.cpp(59) : error C2039: 'compare' : is not a member of 'hx::Object'
        C:\Motion-Twin\haxe\lib\hxcpp\2,07,0\include\hx/Object.h(53) : see declaration of 'hx::Object'

works with --no-inline switch.

I tried to simplify the code as much as possible:

//----- file Main.hx
import Heap;

class Main {
    static function main() {}
}

//----- file Element.hx

interface Element<T> {
    function compare(x:T):Int;
}

//----- file Heap.hx
class Heap<T:(Element<T>)> {
    var _a:Array<T>;
    
    public function new() {}
    
    inline public function pop():T {
        var x = _get(1);
        _downheap(1);
        return x;
    }
    
    public function foo():Void {
        var tmp = new Heap<E<T>>();
        var x = tmp.pop();
    }
    
    inline function _downheap(i:Int):Void {
        var result = _get(0).compare(_get(1));
    }
    
    inline function _get(i:Int):T {
        return _a[i];
    }
}

private class E<T:(Element<T>)> implements Element<E<T>> {
    public function new() {}
    public function compare(x:E<T>):Int { return 0; }
}
Aug 10, 2011
Project Member #1 gameh...@gmail.com
This should be fixed now.
Status: Fixed