diff --git a/.gitattributes b/.gitattributes index 8698eca4a6..8ce1dfcb7b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14966,6 +14966,7 @@ tests/webtbs/tw23980.pp svneol=native#text/pascal tests/webtbs/tw24007.pp svneol=native#text/plain tests/webtbs/tw24071.pp svneol=native#text/pascal tests/webtbs/tw24072.pp svneol=native#text/pascal +tests/webtbs/tw24073.pp svneol=native#text/pascal tests/webtbs/tw2409.pp svneol=native#text/plain tests/webtbs/tw24129.pp svneol=native#text/pascal tests/webtbs/tw24131.pp svneol=native#text/plain diff --git a/compiler/pgenutil.pas b/compiler/pgenutil.pas index 788fa96163..7e56f5fe34 100644 --- a/compiler/pgenutil.pas +++ b/compiler/pgenutil.pas @@ -144,7 +144,22 @@ uses begin case formaldef.typ of recorddef: - MessagePos(filepos,type_e_record_type_expected); + { delphi has own fantasy about record constraint + (almost non-nullable/non-nilable value type) } + if m_delphi in current_settings.modeswitches then + case paradef.typ of + floatdef,enumdef,orddef: + continue; + objectdef: + if tobjectdef(paradef).objecttype=odt_object then + continue + else + MessagePos(filepos,type_e_record_type_expected); + else + MessagePos(filepos,type_e_record_type_expected); + end + else + MessagePos(filepos,type_e_record_type_expected); objectdef: case tobjectdef(formaldef).objecttype of odt_class, diff --git a/tests/webtbs/tw24073.pp b/tests/webtbs/tw24073.pp new file mode 100644 index 0000000000..9087d98258 --- /dev/null +++ b/tests/webtbs/tw24073.pp @@ -0,0 +1,30 @@ +{ %NORUN } + +{$MODE DELPHI} + +type + TA = record + end; + + TUnamanagedRec = record + x: integer; + end; + + TManagedRec = record + s: string; + end; + + TEnum = (e1, e2, e3); + + TObj = object + end; + +var + a: TA; + b: TA; + d: TA; + e: TA; + f: TA; + g: TA; +begin +end. \ No newline at end of file