diff --git a/compiler/ncgld.pas b/compiler/ncgld.pas index e5744b2b7b..e47647c2ba 100644 --- a/compiler/ncgld.pas +++ b/compiler/ncgld.pas @@ -817,9 +817,8 @@ implementation objectdef : if is_interface(lt) then vtype:=vtInterface + { vtObject really means a class based on TObject } else if is_class(lt) then - vtype:=vtClass - else if is_object(lt) then vtype:=vtObject else internalerror(200505171); diff --git a/compiler/nld.pas b/compiler/nld.pas index 0a3accc5c1..f8bdad449c 100644 --- a/compiler/nld.pas +++ b/compiler/nld.pas @@ -989,8 +989,11 @@ implementation stringdef, variantdef, pointerdef, - classrefdef, - objectdef : ; + classrefdef: + ; + objectdef : + if is_object(hp.left.resulttype.def) then + CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename); else CGMessagePos1(hp.left.fileinfo,type_e_wrong_type_in_array_constructor,hp.left.resulttype.def.typename); end; diff --git a/tests/webtbs/tw3973.pp b/tests/webtbs/tw3973.pp index 5c969baaec..afe42dc133 100644 --- a/tests/webtbs/tw3973.pp +++ b/tests/webtbs/tw3973.pp @@ -40,7 +40,7 @@ var Check('Interface(nil)', a[1], vtInterface); Check('Interface', a[2], vtInterface); { TObject is a class as well! } - Check('Class Object(nil)', a[3], vtClass); + Check('Class Object(nil)', a[3], vtObject); Check('Class', a[4], vtClass); {$IFDEF FPC} Check('QWord', a[5], vtQWord);