mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 23:59:10 +02:00
* prohibit static array constants inside dynamic array constants for Delphi modes
+ added test git-svn-id: trunk@39045 -
This commit is contained in:
parent
31a9ed573c
commit
dcdb151add
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12504,6 +12504,7 @@ tests/test/tarray13.pp svneol=native#text/pascal
|
|||||||
tests/test/tarray14.pp svneol=native#text/pascal
|
tests/test/tarray14.pp svneol=native#text/pascal
|
||||||
tests/test/tarray15.pp svneol=native#text/pascal
|
tests/test/tarray15.pp svneol=native#text/pascal
|
||||||
tests/test/tarray16.pp svneol=native#text/pascal
|
tests/test/tarray16.pp svneol=native#text/pascal
|
||||||
|
tests/test/tarray17.pp svneol=native#text/pascal
|
||||||
tests/test/tarray2.pp svneol=native#text/plain
|
tests/test/tarray2.pp svneol=native#text/plain
|
||||||
tests/test/tarray3.pp svneol=native#text/plain
|
tests/test/tarray3.pp svneol=native#text/plain
|
||||||
tests/test/tarray4.pp svneol=native#text/plain
|
tests/test/tarray4.pp svneol=native#text/plain
|
||||||
|
@ -1197,6 +1197,16 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
{ Delphi does not correctly parse static array constants
|
||||||
|
inside dynamic array constants. Additionally static and
|
||||||
|
dynamic array constants use different syntaxes ("(...)"
|
||||||
|
vs. "[...]"), so it's safer we simply disallow it until
|
||||||
|
the Delphi developers clears up this mess if ever }
|
||||||
|
if (m_delphi in current_settings.modeswitches) and
|
||||||
|
(def.elementdef.typ=arraydef) and
|
||||||
|
not is_dynamic_array(def.elementdef) then
|
||||||
|
Message(parser_e_no_static_array_const_in_dynarray_const);
|
||||||
|
|
||||||
if fsym.varspez=vs_const then
|
if fsym.varspez=vs_const then
|
||||||
sectype:=sec_rodata
|
sectype:=sec_rodata
|
||||||
else
|
else
|
||||||
|
12
tests/test/tarray17.pp
Normal file
12
tests/test/tarray17.pp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{ %FAIL }
|
||||||
|
|
||||||
|
program tarray17;
|
||||||
|
|
||||||
|
{$mode delphi}
|
||||||
|
|
||||||
|
var
|
||||||
|
v1: array of array[0..2] of LongInt = [(1, 2, 3), (4, 5, 6)];
|
||||||
|
|
||||||
|
begin
|
||||||
|
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user