https://issues.dlang.org/show_bug.cgi?id=13271
Issue ID: 13271 Summary: opDispatch fails without warning message if @property Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: DMD Assignee: nob...@puremagic.com Reporter: vlevenf...@gmail.com struct Vector (uint length, Element = double) { ref @property component (string c)() { enum mat = q{xyzw}; enum col = q{rgba}; enum tex = q{uv}; static if (mat.canFind (c)) return components[mat.countUntil (c)]; else static if (col.canFind (c)) return components[col.countUntil (c)]; else static if (tex.canFind (c)) return components[tex.countUntil (c)]; else static assert (0); } ref @property opDispatch (string c)() if (c.length == 1) { auto v = component!c; pragma(msg, typeof(v)); // this outputs the expected result return v; // so everything is fine, right? wrong... } Element[length] components; } If @property opDispatch is replaced with auto opDispatch then it works. opDispatch should either work for properties or should give a more meaningful error message than "Error: No property `x` for Vector" etc. --