Thread overview
[Issue 17444] std.traits.isCallable doesn't recognize struct member function if return type is 'auto'.
May 27, 2017
Dario Schiavon
Nov 18, 2022
RazvanN
May 27, 2017
https://issues.dlang.org/show_bug.cgi?id=17444

uplink.coder@googlemail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |uplink.coder@googlemail.com

--- Comment #1 from uplink.coder@googlemail.com ---
This has to do with the order of symbol resolving.
You will see that it will print good, if you put the static if outside of the
struct body.

--
May 27, 2017
https://issues.dlang.org/show_bug.cgi?id=17444

--- Comment #2 from Dario Schiavon <dario.schiavon@gmail.com> ---
(In reply to uplink.coder from comment #1)
> This has to do with the order of symbol resolving.
> You will see that it will print good, if you put the static if outside of
> the struct body.

Thanks for the prompt answer. Do you mean that this is the intended behavior, or is it still a bug?

I'll explain what I'm trying to achieve: a mixin template that will automatically define a member function foo if it is not already present. However, the fact that it works in some situations and not in others is mildly annoying. Maybe you can suggest a better approach?

--
May 27, 2017
https://issues.dlang.org/show_bug.cgi?id=17444

--- Comment #3 from uplink.coder@googlemail.com ---
I would classify this as a bug, however it seems like a fix for this would break other situations.

for now the best workaround is to not use functions returning auto inside that struct.

--
November 18, 2022
https://issues.dlang.org/show_bug.cgi?id=17444

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305@gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #4 from RazvanN <razvan.nitu1305@gmail.com> ---
I cannot reproduce this. The code in the bug report prints "GOOD" in both situations (return type "auto" or return type "MyStrut").

Closing as WORKSFORME.

--