@@ -824,7 +824,7 @@ private sub hValidateGlobalVarInit( byval sym as FBSYMBOL ptr, byref initree as
824824
825825 '' Disallow initialization of global dynamic strings
826826 '' (not implemented - requires executing code)
827- if ( symbGetType( sym ) = FB_DATATYPE_STRING ) then
827+ if ( ( symbGetType( sym ) = FB_DATATYPE_STRING) and ( not symbIsRef( sym )) ) then
828828 errReport( FB_ERRMSG_CANTINITDYNAMICSTRINGS, TRUE )
829829 astDelTree( initree )
830830 initree = NULL
@@ -833,7 +833,7 @@ private sub hValidateGlobalVarInit( byval sym as FBSYMBOL ptr, byref initree as
833833
834834 '' Check for constant initializer?
835835 '' (doing this check first, it results in a nicer error message)
836- if ( symbHasCtor( sym ) = FALSE ) then
836+ if ( ( not symbHasCtor( sym )) or symbIsRef( sym ) ) then
837837 if ( astTypeIniIsConst( initree ) = FALSE ) then
838838 errReport( FB_ERRMSG_EXPECTEDCONST )
839839 astDelTree( initree )
@@ -877,9 +877,7 @@ private function hCheckAndBuildByrefInitializer( byval sym as FBSYMBOL ptr, byre
877877 astTypeIniAddAssign( initree, astNewADDROF( expr ), sym, ptrdtype, ptrsubtype )
878878 astTypeIniEnd( initree, TRUE )
879879
880- if ( (symbGetAttrib( sym ) and (FB_SYMBATTRIB_STATIC or FB_SYMBATTRIB_SHARED)) <> 0 ) then
881- hCheckVarsUsedInGlobalInit( sym, initree )
882- end if
880+ hValidateGlobalVarInit( sym, initree )
883881
884882 function = initree
885883end function
0 commit comments