mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-09 21:08:26 +02:00
* allow type casted pointer constants being used as arrays which address can be takes, resolves #41177
This commit is contained in:
parent
4acf7d25a0
commit
36e9e39bca
@ -1750,7 +1750,15 @@ implementation
|
|||||||
niln,
|
niln,
|
||||||
pointerconstn :
|
pointerconstn :
|
||||||
begin
|
begin
|
||||||
if report_errors then
|
{ this is an implicit dereference, so it is valid for assign }
|
||||||
|
if hp.resultdef.typ=arraydef then
|
||||||
|
begin
|
||||||
|
valid_for_assign:=true;
|
||||||
|
mayberesettypeconvs;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if report_errors then
|
||||||
CGMessagePos(hp.fileinfo,type_e_no_assign_to_addr);
|
CGMessagePos(hp.fileinfo,type_e_no_assign_to_addr);
|
||||||
mayberesettypeconvs;
|
mayberesettypeconvs;
|
||||||
exit;
|
exit;
|
||||||
|
12
tests/webtbs/tw41177.pp
Normal file
12
tests/webtbs/tw41177.pp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
program test;
|
||||||
|
{$pointermath on}
|
||||||
|
|
||||||
|
type
|
||||||
|
PRec = ^TRec;
|
||||||
|
TRec = record
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
argv:=@PRec(0)[0]; // OK
|
||||||
|
argv:=@PRec(nil)[0]; // NotOK - "Can't assign values to an address"
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user