This is expected behavior and is the result of the S-Function not having any output.
The S-Function is written to inherit sample times. When you set the Constant block's sample time property to "inf", note that the color of the constant and the S-function both change to magenta if sample time colors are in use. From the documentation: magenta means "constant sample time", i.e. invariant. The S-Function inherits the constant sample time and gets optimized as requested. Since it has no output, nothing is assigned into the rtC data structure. More information on the rtC data structure can be found by entering the following at the MATLAB Command Prompt:
web([docroot,'/toolbox/rtw/rtw_ug/f354.html']) )
If a signal is constant and the configuration says to inline invariant signals (and the S-function has no outputs), then there is no reason to call the S-function.
If the S-function has side effects and it needs to run for some reason that was not registered with Simulink, it should not register to inherit an "inf" sample time. Instead it should require a non-constant sample time. This would then imply that the constant block not use inf for the sample time (i.e., keep the sample time at -1).
For more information, see the documentation on ssSetOptions in "Writing S-functions" by typing the following at the MATLAB command prompt:
web([docroot,'/toolbox/simulink/sfg/sssetoptions.html'])
Also, for more information on sample time colors in your Simulink model, refer to the documentation here:
web([docroot,'/toolbox/simulink/ug/creating_model8.html'])