Fix a bug in generic function handling when context locals are disabled.

Fixes bug 1364113

Change-Id: I192c75b73ae95338dc2f1ea019e83a42fb8da87b