Thread overview |
---|
March 01, 2019 [Issue 19710] template parameters not deduced when one is is a supplied string, and the other inferred. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19710 Alex <alex@sunopti.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alex@sunopti.com Summary|[Home] |template parameters not | |deduced when one is is a | |supplied string, and the | |other inferred. -- |
March 02, 2019 [Issue 19710] template parameters not deduced when one is is a supplied string, and the other inferred. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19710 Sprink <sprink.noreply@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |sprink.noreply@gmail.com Resolution|--- |WONTFIX --- Comment #1 from Sprink <sprink.noreply@gmail.com> --- Manually insert the type and you will see "this" is considered as an rvalue. It was deprecated in DMD 2.067.1 to 2.071.2: Deprecation: this is not an lvalue -- |
March 04, 2019 [Issue 19710] template parameters not deduced when one is is a supplied string, and the other inferred. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19710 --- Comment #2 from Alex <alex@sunopti.com> --- 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. -- |
Copyright © 1999-2021 by the D Language Foundation