port t4c1's changes to forward_as to this PR
port t4c1's changes to forward_as to this PR

stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math,stan-dev/math