May 16 [Issue 23915] Instance method properties not evaluated when passed to template value argument | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23915 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> --- This doesn't seem to have anything to do with property. This yields the same result: ``` template T(bool value) {} bool getValue() { return true; } alias Inst1 = T!(getValue); // OK struct S2 { static bool getValue() { return true; } } alias Inst2 = T!(S2.getValue); // OK struct S3 { bool getValue() { return true; } } alias Inst = T!(S3().getValue); // Error ``` -- |
May 16 [Issue 23915] Instance method properties not evaluated when passed to template value argument | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23915 --- Comment #2 from RazvanN <razvan.nitu1305@gmail.com> --- I've tried to entangle what happens here, but the behavior is a bit puzzling. It turns out that free functions and static member functions are considered types when instantiating the template, but the `S3().getValue` is considered an expression. On the expression path of the code, since the () are missing, this is seen as just refering to the symbol `getValue` not actually calling it. Resolving `getValue` to a function fixes the issue but it makes other parts of the template instantiation mechanism fail, so I'm stuck at this point. There's just too much context that I'm missing: I have no idea why `S2.getValue` or `getValue` are treated as types in this scenario. They must be resolved somehow later to their corresponding expressions. -- |
Copyright © 1999-2021 by the D Language Foundation