After some experimenting I narrowed it down to the attached patch: reverting this change unbreaks the build on master. Michael?