mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-08 11:48:04 +02:00
* don't crash when searching for a type helper in an anonymous array (or
other non-record/objectdef-based) type (mantis #25504) git-svn-id: trunk@26459 -
This commit is contained in:
parent
123742647c
commit
5fc4af09dd
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12614,6 +12614,7 @@ tests/webtbf/tw2478.pp svneol=native#text/plain
|
||||
tests/webtbf/tw25029.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw25215.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw25318.pp svneol=native#text/pascal
|
||||
tests/webtbf/tw25504.pp svneol=native#text/plain
|
||||
tests/webtbf/tw2562.pp svneol=native#text/plain
|
||||
tests/webtbf/tw2657.pp svneol=native#text/plain
|
||||
tests/webtbf/tw2670.pp svneol=native#text/plain
|
||||
|
@ -3139,11 +3139,13 @@ implementation
|
||||
if current_module.extendeddefs.count=0 then
|
||||
exit;
|
||||
{ no helpers for anonymous types }
|
||||
if (pd.typ in [recorddef,objectdef]) and
|
||||
if ((pd.typ in [recorddef,objectdef]) and
|
||||
(
|
||||
not assigned(tabstractrecorddef(pd).objrealname) or
|
||||
(tabstractrecorddef(pd).objrealname^='')
|
||||
) then
|
||||
)
|
||||
) or
|
||||
not assigned(pd.typesym) then
|
||||
exit;
|
||||
{ if pd is defined inside a procedure we must not use make_mangledname
|
||||
(as a helper may not be defined in a procedure this is no problem...)}
|
||||
|
44
tests/webtbf/tw25504.pp
Normal file
44
tests/webtbf/tw25504.pp
Normal file
@ -0,0 +1,44 @@
|
||||
{ %fail }
|
||||
program test;
|
||||
|
||||
{$MODE DELPHI}
|
||||
|
||||
{ Commenting the next block of code causes compiler to properly show error message in "Data.HelloWorld".
|
||||
Otherwise, it throws error:
|
||||
Fatal: Compilation aborted
|
||||
An unhandled exception occurred at $00437C5E:
|
||||
EAccessViolation: Access violation
|
||||
$00437C5E
|
||||
}
|
||||
type
|
||||
// {
|
||||
TDateTimeStamp = record
|
||||
Value: Int64;
|
||||
end;
|
||||
|
||||
const
|
||||
InvalidDateTimeStampValue = Low(Int64);
|
||||
|
||||
type
|
||||
TDateTimeStampHelper = record helper for TDateTimeStamp
|
||||
const Invalid: TDateTimeStamp = (Value: InvalidDateTimeStampValue);
|
||||
end;
|
||||
// }
|
||||
|
||||
TSomeOtherClass = class
|
||||
end;
|
||||
|
||||
TSomeClass = class
|
||||
private
|
||||
Data: array of TSomeOtherClass;
|
||||
public
|
||||
procedure Test;
|
||||
end;
|
||||
|
||||
procedure TSomeClass.Test;
|
||||
begin
|
||||
Data.HelloWorld;
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user