Issue 13120 - Body of `foreach` over string with transcoding ignores function attributes

https://issues.dlang.org/show_bug.cgi?id=13120

Based on the PR #3626.