struct Struct{ string str; } void bar(ref string str){ str = str[0..0]; } static assert({ auto s = Struct("foo"); bar(s.str); return true; }()); This code does't work.
Related to bug 6934. It's fixed in this two-week old pull request: https://github.com/D-Programming-Language/dmd/pull/522
*** This issue has been marked as a duplicate of issue 6934 ***