https://issues.dlang.org/show_bug.cgi?id=22209
Issue ID: 22209 Summary: NRVO variable detection ignoring `alias this` conversion => segfaults Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: ki...@gmx.net This segfaults at runtime (for all versions currently on run.dlang.io): ``` struct U { size_t[4] a; } struct S { int x; U u; alias u this; } U foo() { S s = S(42, U([1, 2, 3, 4])); return s; } void main() { assert(foo().a[0] == 1); } ``` It's apparently caused by the frontend wrongly marking `s` in `foo()` as the NRVO variable (FuncDeclaration.nrvo_var), ignoring that it requires an implicit conversion via `alias this` - return type and variable type clearly differ. --