diff options
author | peter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2006-08-07 19:10:11 +0000 |
---|---|---|
committer | peter <peter@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2006-08-07 19:10:11 +0000 |
commit | 05154ec51aa65556272c64b42afcdb2848648c92 (patch) | |
tree | 82291211749cd8dc6e29e01405abb76f34fb0e6d /tests/webtbf | |
parent | 270eeaaa7c39cc4502b36c4d1fcaf1313038434f (diff) | |
download | fpc-05154ec51aa65556272c64b42afcdb2848648c92.tar.gz |
* pass context class to searchsym_in_class to fix the visibility
of protected members called from a named class in a child class
that also has the visibility for those protected members
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@4384 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'tests/webtbf')
-rw-r--r-- | tests/webtbf/tw6922.pp | 35 | ||||
-rw-r--r-- | tests/webtbf/uw6922.pp | 23 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/webtbf/tw6922.pp b/tests/webtbf/tw6922.pp new file mode 100644 index 0000000000..c02fc2a39b --- /dev/null +++ b/tests/webtbf/tw6922.pp @@ -0,0 +1,35 @@ +{ %fail } +{$ifdef fpc}{$mode objfpc}{$H+}{$endif} + +uses uw6922; + +type + + { TC } + + TC=class(TA) + public + procedure Test; + end; + +{ TC } + +procedure TC.Test; +var + B: TB; +begin + T := 'Test1'; // allowed, because it is a descendant + B := TB.Create; + B.T := 'Test2'; // should not be allowed + writeln(B.T); + B.Free; +end; + +var + c: TC; +begin + c := TC.Create; + c.T := 'Test3'; // allowed, because it is in the same 'unit' + c.Test; + c.Free; +end. diff --git a/tests/webtbf/uw6922.pp b/tests/webtbf/uw6922.pp new file mode 100644 index 0000000000..7751848ad4 --- /dev/null +++ b/tests/webtbf/uw6922.pp @@ -0,0 +1,23 @@ +unit uw6922; + +{$ifdef fpc}{$mode objfpc}{$H+}{$endif} + +interface + +type + + { TA } + + TA = class + private + FT: string; + protected + property T: string read FT write FT; + end; + + TB = class(TA) + end; + +implementation + +end. |