blob: ad8e9c6ac5b302f587e8d8d436e6b38d58043af6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
{ %NORUN }
program tw38145b;
{$mode objfpc}{$modeswitch advancedrecords}
type
generic TMyWrap<T> = record
Value: T;
class operator Explicit(const w: TMyWrap): T;
class operator :=(const w: TMyWrap): T;
end;
class operator TMyWrap.Explicit(const w: TMyWrap): T;
begin
Result := w.Value;
end;
class operator TMyWrap.:=(const w: TMyWrap): T;
begin
Result := w.Value;
end;
type
//TString = string[255]; //compiles
TString = string[254]; //not compiles
var
MySpec: specialize TMyWrap<TString>;
begin
end.
|