diff --git a/.gitattributes b/.gitattributes index e0759023d2..8aae5d880f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16071,6 +16071,7 @@ tests/webtbf/tw3583.pp svneol=native#text/plain tests/webtbf/tw35866.pp svneol=native#text/pascal tests/webtbf/tw35981.pp svneol=native#text/pascal tests/webtbf/tw36114.pp svneol=native#text/pascal +tests/webtbf/tw36223.pp svneol=native#text/pascal tests/webtbf/tw3626.pp svneol=native#text/plain tests/webtbf/tw3631.pp svneol=native#text/plain tests/webtbf/tw3643.pp svneol=native#text/plain diff --git a/compiler/symtable.pas b/compiler/symtable.pas index 77eb5034fc..22269a68f4 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -3916,8 +3916,17 @@ implementation exit; end; { now search all helpers using the extendeddef as the starting point } - if m_multi_helpers in current_settings.modeswitches then - result:=search_best_objectpascal_helper(s,classh.extendeddef,contextclassh,srsym,srsymtable); + if (m_multi_helpers in current_settings.modeswitches) and + ( + (current_structdef<>classh) or + assigned(classh.extendeddef) + ) then + begin + { this is only allowed if classh is currently parsed } + if not assigned(classh.extendeddef) then + internalerror(2019110101); + result:=search_best_objectpascal_helper(s,classh.extendeddef,contextclassh,srsym,srsymtable); + end; end; function search_specific_assignment_operator(assignment_type:ttoken;from_def,to_def:Tdef):Tprocdef; diff --git a/tests/webtbf/tw36223.pp b/tests/webtbf/tw36223.pp new file mode 100644 index 0000000000..d59ae0c51d --- /dev/null +++ b/tests/webtbf/tw36223.pp @@ -0,0 +1,18 @@ +{ %FAIL } + +{$mode objfpc} +{$modeswitch multihelpers} + +unit tw36223; +interface +uses + SysUtils; + +type + // ERROR: Compilation raised exception internally + TMyHelper = class helper for TSomeObject + end; + +implementation + +end.