Add a test case for PR3779: when to promote the function return value.