diff --git a/.gitattributes b/.gitattributes index adc13dc37d..f98afd00bc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6579,6 +6579,7 @@ tests/tbf/tb0210.pp svneol=native#text/plain tests/tbf/tb0211.pp svneol=native#text/plain tests/tbf/tb0212.pp svneol=native#text/plain tests/tbf/tb0213.pp svneol=native#text/plain +tests/tbf/tb0214.pp svneol=native#text/plain tests/tbf/ub0115.pp svneol=native#text/plain tests/tbf/ub0149.pp svneol=native#text/plain tests/tbf/ub0158a.pp svneol=native#text/plain diff --git a/tests/tbf/tb0214.pp b/tests/tbf/tb0214.pp new file mode 100644 index 0000000000..babe339383 --- /dev/null +++ b/tests/tbf/tb0214.pp @@ -0,0 +1,36 @@ +{ %fail } + +{$ifdef fpc} +{$mode delphi} +{$endif} + +type + tc = class + private + fo: tobject; + function getfo(i: integer): tobject; + procedure putfo(i: integer; o: tobject); + public + property o[i:integer]: tobject read getfo write putfo; default; + end; + +function tc.getfo(i:integer): tobject; +begin + result:=fo; +end; + +procedure tc.putfo(i: integer; o: tobject); +begin + fo:=o; +end; + +var + c: tc; +begin + c:=tc.create; + { should give an error stating that you cannot assign to left hand side } + { (generated code also does not result in an assignment) } + tc(c[5]):=tc(5); + writeln(longint(c[5])); +end. +