https://issues.dlang.org/show_bug.cgi?id=19710
--- Comment #2 from Alex <[email protected]> --- The solution I found was to make two versions of this attribute function with different names. One for structs and one for classes. The ref is necessary to have it work for structs. The ref fails when used with 'this' in classes. I think the underlying problem is that in the class version, the ref refers to the object reference (pointer), not the object pointed to, so the ref is unnecessary, and in the case where this is passed, illegal. In the struct version, the ref refers to the object itself, and is necessary to prevent it being copied and operations happening to a local version. This is a bit unfortunate, it would be nice to have a template that could work with either. --
