https://issues.dlang.org/show_bug.cgi?id=16655

ag0ae...@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ag0ae...@gmail.com
         Resolution|---                         |INVALID

--- Comment #3 from ag0ae...@gmail.com ---
(In reply to Nick Treleaven from comment #0)
> The static asserts below fail:
> 
> struct Color {struct Red {}}
> 
> unittest {
>       import std.traits;
> 
>       alias ls = (string) => "string";
>       static assert(isSomeFunction!ls);
> 
>       with (Color) {
>               alias lc = (Red) => "red";
>               static assert(isSomeFunction!lc);
>       }
> }

This is a gotcha, but it's not a bug. In a function literal, a single
identifier is interpreted as the name of the parameter, not the type. So
`string` and `Red` do not refer to the types of the same names, but they're
parameter names. Consequently, ls and lc are not functions, but templates,
because the parameters are not typed yet.

Closing as invalid. Please reopen if I'm missing something.

--

Reply via email to