2014-04-15 17:21 GMT+08:00 Sven Barth :
Show quoted text 8 lines
Am 15.04.2014 08:47 schrieb "Xiangrong Fang" :
> It's good to know that it works, at least in 2.7.1. I will report the
problem again while I start using 2.7.1 or when it is released as 2.8 :-)
That's the point: I don't know wether it compiles in 2.7.1 as I did not
test it. If you could provide a minimal sample (which fails in 2.6.2) and
report that as a bug I could ensure that 2.7.1 works correctly there.
I cannot replicate the problem using a minimal program, because it gives out different error message. The following minimal program compiles OK:
program vectr;
type
generic TGeneric1<T> = class
end;
generic TGeneric2<T> = class
end;
TSpec1 = specialize TGeneric1<Integer>;
TSpec2 = specialize TGeneric2<TSpec1>;
begin
end.
While the following program generate different error:
program vectr;
uses
treap, vector;
type
TNodeHash = specialize TTreap<Integer, string>;
TNodeVector = class(specialize TVector<TNodeHash>)
protected
function OnSort(v1, v2: T): Integer; override;
end;
operator <(nh1, nh2: TNodeHash): Boolean;
begin
Result := nh1.Count < nh2.Count;
end;
operator >(nh1, nh2: TNodeHash): Boolean;
begin
Result := nh1.Count > nh2.Count;
end;
function TNodeVector.OnSort(v1, v2: T): Integer;
begin
Result := 0;
end;
begin
end.
gives error message:
vector.pas(149,9) Error: Operator is not overloaded: "TTreap$LongInt$AnsiString" < "TTreap$LongInt$AnsiString" vector.pas(151,14) Error: Operator is not overloaded: "TTreap$LongInt$AnsiString" > "TTreap$LongInt$AnsiString" vectr.lpr(28) Fatal: There were 2 errors compiling module, stopping
The two used units can be downloaded here:
https://github.com/xrfang/fpcollection/
While in my real program, I have this:
type
TCmhWaves = specialize TVector<TCmhWave>;
The thing is, even if I do NOT use this definition at all, it still crashes the compiler. By "crash" I mean I get this from lazarus:
Compiling wmodel.lError: /usr/bin/ppcx64 can't be executed, error message: Failed to execute "/usr/bin/ppcx64", error code: -139
TCmhWave is a specialized subclass of My TTreap class (also on github), it does NOT overload the < and > operators either.
So my question is:
1) why my simplified example still require overloaded operator, although I have already done so?
2) If this is the cause of error (TCmhWave does not have these operators defined), why the compiler returns error code: -139 instead of more detailed errors?
BTW, on my first attempt to debug this problem in lazbuild (command line) I get some error related to VMA, but unfortunately I forgot what it is and cannot get it shown again. Is there any way to customize the lazbuild by some switches to let it output more messages?
Thanks.