[fpc-pascal] Re: generics question

2011-05-15 Thread leledumbo
My guess is that because there's only one Blah, it would be OK. Now try specializing TTestGen with String. -- View this message in context: http://free-pascal-general.1045716.n5.nabble.com/generics-question-tp4389896p4397750.html Sent from the Free Pascal - General mailing list archive at Nabble.

Re: [fpc-pascal] Re: generics question

2011-05-14 Thread Adrian Veith
But is very strange, that this works: type TTestGen = class constructor Create(); class function Test(val: T): string; inline; end; function Blah(const val: Integer): string; inline; //overload; begin Result:= IntToStr(val + 1); end; {function Blah(const val: string): string; inli

[fpc-pascal] Re: generics question

2011-05-14 Thread leledumbo
Err... because at the time, T is not yet known. It would still fail to compile even if you don't do any specialization. I guess the compiler does type checking while parsing the generic class (and its methods) declaration, not while specializing (well... it would still do type checking when special