mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 20:59:42 +02:00
compiler: don't allow to access an enum members through the enum member. It should be only possible throught the enum type name. Fixes issue #0025029
git-svn-id: trunk@25493 -
This commit is contained in:
parent
9577aa1d0b
commit
93f1ba4493
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12455,6 +12455,7 @@ tests/webtbf/tw24428a.pp svneol=native#text/plain
|
||||
tests/webtbf/tw24495.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw24588.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw2478.pp svneol=native#text/plain
|
||||
tests/webtbf/tw25029.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw2562.pp svneol=native#text/plain
|
||||
tests/webtbf/tw2657.pp svneol=native#text/plain
|
||||
tests/webtbf/tw2670.pp svneol=native#text/plain
|
||||
|
@ -2096,7 +2096,7 @@ implementation
|
||||
if token=_ID then
|
||||
begin
|
||||
srsym:=tsym(tenumdef(p1.resultdef).symtable.Find(pattern));
|
||||
if assigned(srsym) and (srsym.typ=enumsym) then
|
||||
if assigned(srsym) and (srsym.typ=enumsym) and (p1.nodetype=typen) then
|
||||
begin
|
||||
p1.destroy;
|
||||
check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
|
||||
|
9
tests/webtbf/tw25029.pp
Normal file
9
tests/webtbf/tw25029.pp
Normal file
@ -0,0 +1,9 @@
|
||||
{%FAIL}
|
||||
program tw25029;
|
||||
type
|
||||
TMyEnum = (me1, me2, me3);
|
||||
var
|
||||
e: TMyEnum;
|
||||
begin
|
||||
e := me1.me2;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user