* fix for Mantis #36114: when converting a static class field to a global variable the varspez of the field needs to be respected

+ added test

git-svn-id: trunk@43116 -
This commit is contained in:
svenbarth 2019-10-03 16:39:40 +00:00
parent b4e998b3f8
commit beb606be13
3 changed files with 24 additions and 1 deletions

1
.gitattributes vendored
View File

@ -16063,6 +16063,7 @@ tests/webtbf/tw35753.pp svneol=native#text/plain
tests/webtbf/tw3583.pp svneol=native#text/plain
tests/webtbf/tw35866.pp svneol=native#text/pascal
tests/webtbf/tw35981.pp svneol=native#text/pascal
tests/webtbf/tw36114.pp svneol=native#text/pascal
tests/webtbf/tw3626.pp svneol=native#text/plain
tests/webtbf/tw3631.pp svneol=native#text/plain
tests/webtbf/tw3643.pp svneol=native#text/plain

View File

@ -1960,7 +1960,7 @@ implementation
constructor tstaticvarsym.create_from_fieldvar(const n: string;fieldvar:tfieldvarsym);
begin
create(internal_static_field_name(n),vs_value,fieldvar.vardef,[]);
create(internal_static_field_name(n),fieldvar.varspez,fieldvar.vardef,[]);
fieldvarsym:=fieldvar;
end;

22
tests/webtbf/tw36114.pp Normal file
View File

@ -0,0 +1,22 @@
{ %FAIL }
program tw36114;
{$mode objfpc}{$H+}{$J-}
type
TTestme=class
strict private
const
{$push}{$writeableconst off} // superfluous but also doesn't work
c_one:integer = 1;
c_two:integer = 10;
{$pop}
public
class property one:integer read c_one;
class property two:integer read c_two;
end;
begin
TTestme.c_one := 1000;
writeln(TTestme.One);
end.