mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 18:59:32 +02:00
* support for constant char/bool/enum indices in typed constant
index expressions (mantis #34055) * prevent all indirect structure indexing instead of only ansi/wide/unicodestrings git-svn-id: trunk@40010 -
This commit is contained in:
parent
2c7c0d1144
commit
2a3eeab96d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -16392,6 +16392,7 @@ tests/webtbs/tw33898.pp -text svneol=native#text/pascal
|
||||
tests/webtbs/tw3402.pp svneol=native#text/plain
|
||||
tests/webtbs/tw34021.pp -text svneol=native#text/pascal
|
||||
tests/webtbs/tw34037.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw34055.pp svneol=native#text/plain
|
||||
tests/webtbs/tw3411.pp svneol=native#text/plain
|
||||
tests/webtbs/tw34124.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw3418.pp svneol=native#text/plain
|
||||
|
@ -916,9 +916,11 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
||||
case hp.nodetype of
|
||||
vecn :
|
||||
begin
|
||||
if is_constintnode(tvecnode(hp).right) and
|
||||
not is_ansistring(tvecnode(hp).left.resultdef) and
|
||||
not is_wide_or_unicode_string(tvecnode(hp).left.resultdef) then
|
||||
if (is_constintnode(tvecnode(hp).right) or
|
||||
is_constenumnode(tvecnode(hp).right) or
|
||||
is_constcharnode(tvecnode(hp).right) or
|
||||
is_constboolnode(tvecnode(hp).right)) and
|
||||
not is_implicit_array_pointer(tvecnode(hp).left.resultdef) then
|
||||
ftcb.queue_vecn(tvecnode(hp).left.resultdef,get_ordinal_value(tvecnode(hp).right))
|
||||
else
|
||||
Message(parser_e_illegal_expression);
|
||||
|
24
tests/webtbs/tw34055.pp
Normal file
24
tests/webtbs/tw34055.pp
Normal file
@ -0,0 +1,24 @@
|
||||
{$mode objfpc}
|
||||
|
||||
type
|
||||
TDOS_FIELDNAMES = (
|
||||
Dos_Signature, // ord = 0
|
||||
Dos_OffsetToNewExecutable // ord = 1
|
||||
);
|
||||
|
||||
|
||||
|
||||
const
|
||||
DosFieldLabelsB : array[TDOS_FIELDNAMES]
|
||||
of pwidechar =
|
||||
(
|
||||
'DOS signature',
|
||||
'offset to new executable'
|
||||
);
|
||||
|
||||
d : ppwidechar = @DosFieldLabelsB[Dos_OffsetToNewExecutable];
|
||||
|
||||
begin
|
||||
if d<>@DosFieldLabelsB[Dos_OffsetToNewExecutable] then
|
||||
halt(1);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user