mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 05:19:49 +02:00
* give a proper error when a rangen appears in a vecn that's not an
array parameter (mantis #15287) git-svn-id: trunk@14368 -
This commit is contained in:
parent
b9b95a8f73
commit
b521f80b13
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -9493,6 +9493,7 @@ tests/webtbf/tw14849.pp svneol=native#text/plain
|
||||
tests/webtbf/tw14929a.pp svneol=native#text/plain
|
||||
tests/webtbf/tw14929b.pp svneol=native#text/plain
|
||||
tests/webtbf/tw14946.pp svneol=native#text/plain
|
||||
tests/webtbf/tw15287.pp svneol=native#text/plain
|
||||
tests/webtbf/tw15288.pp svneol=native#text/plain
|
||||
tests/webtbf/tw1599.pp svneol=native#text/plain
|
||||
tests/webtbf/tw1599b.pp svneol=native#text/plain
|
||||
|
@ -893,7 +893,12 @@ implementation
|
||||
else if is_widestring(left.resultdef) and (tf_winlikewidestring in target_info.flags) then
|
||||
exclude(flags,nf_callunique);
|
||||
|
||||
if (not is_packed_array(left.resultdef)) or
|
||||
{ a range node as array index can only appear in function calls, and
|
||||
those convert the range node into something else in
|
||||
tcallnode.gen_high_tree }
|
||||
if (right.nodetype=rangen) then
|
||||
CGMessagePos(right.fileinfo,parser_e_illegal_expression)
|
||||
else if (not is_packed_array(left.resultdef)) or
|
||||
((tarraydef(left.resultdef).elepackedbitsize mod 8) = 0) then
|
||||
if left.expectloc=LOC_CREFERENCE then
|
||||
expectloc:=LOC_CREFERENCE
|
||||
|
19
tests/webtbf/tw15287.pp
Normal file
19
tests/webtbf/tw15287.pp
Normal file
@ -0,0 +1,19 @@
|
||||
{ %fail }
|
||||
|
||||
program arrayrangeoperator;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Classes, SysUtils;
|
||||
|
||||
type
|
||||
TArrayOfInteger = array of integer;
|
||||
var
|
||||
a, b: TArrayOfInteger;
|
||||
begin
|
||||
SetLength(a,10);
|
||||
b:=a[2..4];
|
||||
end.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user