diff --git a/compiler/ninl.pas b/compiler/ninl.pas index dc0fdef670..d9fdfd23d3 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -490,7 +490,18 @@ implementation begin if not assigned(left) or (left.nodetype<>typen) then internalerror(2012032102); + def:=ttypenode(left).typedef; + if df_generic in current_procinfo.procdef.defoptions then + begin + { don't allow as a default parameter value } + if block_type<>bt_const then + result:=cpointerconstnode.create(0,def) + else + result:=cerrornode.create; + exit; + end; + result:=nil; case def.typ of enumdef, @@ -505,16 +516,7 @@ implementation pointerdef: result:=cpointerconstnode.create(0,def); procvardef: - if df_generic in current_procinfo.procdef.defoptions then - begin - { don't allow as a default parameter value } - if block_type<>bt_const then - result:=cpointerconstnode.create(0,def) - else - result:=cerrornode.create; - exit; - end - else if tprocvardef(def).size<>sizeof(pint) then + if tprocvardef(def).size<>sizeof(pint) then result:=getdefaultvarsym(def) else result:=cpointerconstnode.create(0,def);