diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 8add73b06b..3f2049eb67 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -2767,7 +2767,8 @@ implementation else p1:=sub_expr(succ(pred_level),true,typeonly); repeat - if (token in operator_levels[pred_level]) and + if (token in [NOTOKEN..last_operator]) and + (token in operator_levels[pred_level]) and ((token<>_EQ) or accept_equal) then begin oldt:=token; diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 5916cbf35f..49d366375f 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -367,18 +367,18 @@ implementation end else begin - { There is comment few lines before ie 200512115 - saying "We are parsing the same objectdef, the def index numbers - are the same". This is wrong (index numbers are not same) - in case there is specialization (S2 in this case) inside - specialized generic (G2 in this case) which is equal to - some previous specialization (S1 in this case). In that case, - new symbol is not added to currently specialized type - (S in this case) for that specializations (S2 in this case), - and this results in that specialization and generic definition - don't have same number of elements in their object symbol tables. - This patch adds undefined def to ensure that those - two symbol tables will have same number of elements. + { There is comment few lines before ie 200512115 + saying "We are parsing the same objectdef, the def index numbers + are the same". This is wrong (index numbers are not same) + in case there is specialization (S2 in this case) inside + specialized generic (G2 in this case) which is equal to + some previous specialization (S1 in this case). In that case, + new symbol is not added to currently specialized type + (S in this case) for that specializations (S2 in this case), + and this results in that specialization and generic definition + don't have same number of elements in their object symbol tables. + This patch adds undefined def to ensure that those + two symbol tables will have same number of elements. } tundefineddef.create; end; @@ -938,7 +938,7 @@ implementation lv,hv : TConstExprInt; old_block_type : tblock_type; dospecialize : boolean; - structdef: tabstractrecorddef; + structdef: tdef; begin old_block_type:=block_type; dospecialize:=false; @@ -949,13 +949,13 @@ implementation structdef:=current_structdef; while assigned(structdef) and (structdef.typ in [objectdef,recorddef]) do begin - if (structdef.objname^=pattern) then + if (tabstractrecorddef(structdef).objname^=pattern) then begin consume(_ID); def:=structdef; exit; end; - structdef:=tabstractrecorddef(structdef.owner.defowner); + structdef:=tdef(structdef.owner.defowner); end; end; { Generate a specialization in FPC mode? } diff --git a/compiler/symtable.pas b/compiler/symtable.pas index 36594a1aec..f2816a900c 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -761,7 +761,7 @@ implementation begin if b_needs_init_final then exit; - { don't check static symbols - they can be present in structures only and + { don't check static symbols - they can be present in structures only and always have a reference to a symbol defined on unit level } if sp_static in tsym(sym).symoptions then exit; @@ -1916,7 +1916,7 @@ implementation (srsymtable.defowner.typ in [recorddef,objectdef]) and (srsymtable.defowner.owner.symtabletype in [globalsymtable,staticsymtable]) and (srsymtable.defowner.owner.iscurrentunit) then - contextstructdef:=tobjectdef(srsymtable.defowner) + contextstructdef:=tabstractrecorddef(srsymtable.defowner) else contextstructdef:=current_structdef; if not (srsym.owner.symtabletype in [objectsymtable,recordsymtable]) or @@ -1980,7 +1980,7 @@ implementation else begin srsym:=tsym(srsymtable.FindWithHash(hashedid)); - if assigned(srsym) and + if assigned(srsym) and not(srsym.typ in [fieldvarsym,paravarsym,propertysym,procsym,labelsym]) and (not (srsym.owner.symtabletype in [objectsymtable,recordsymtable]) or is_visible_for_object(srsym,current_structdef)) then begin