diff --git a/.gitattributes b/.gitattributes index 0ca260f473..fab394bd58 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12930,6 +12930,7 @@ tests/webtbs/tw2305.pp svneol=native#text/plain tests/webtbs/tw2306.pp svneol=native#text/plain tests/webtbs/tw2307.pp svneol=native#text/plain tests/webtbs/tw2311.pp svneol=native#text/plain +tests/webtbs/tw23110.pp svneol=native#text/plain tests/webtbs/tw2317.pp svneol=native#text/plain tests/webtbs/tw2318.pp svneol=native#text/plain tests/webtbs/tw2318b.pp svneol=native#text/plain diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index bd090c0b10..38fac6c871 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -306,8 +306,9 @@ implementation begin p1:=comp_expr(true,false); consume(_RKLAMMER); - if (not assigned(current_procinfo) or - is_void(current_procinfo.procdef.returndef)) then + if not assigned(current_procinfo) or + (current_procinfo.procdef.proctypeoption in [potype_constructor,potype_destructor]) or + is_void(current_procinfo.procdef.returndef) then begin Message(parser_e_void_function); { recovery } diff --git a/tests/webtbs/tw23110.pp b/tests/webtbs/tw23110.pp new file mode 100644 index 0000000000..9ec766a33e --- /dev/null +++ b/tests/webtbs/tw23110.pp @@ -0,0 +1,11 @@ +type TTest = object + constructor Init; + end; + +constructor TTest.Init; +begin + exit (0); +end; + +begin +end.