[Issue 18850] Template overload incorrectly results in recursive expansion error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 10 20:15:42 UTC 2018


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

ag0aep6g <ag0aep6g at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g at gmail.com

--- Comment #1 from ag0aep6g <ag0aep6g at gmail.com> ---
(In reply to Jonathan Marler from comment #0)
>     alias Foo = Foo!(T, T.init);

Just that line alone shows the same behavior. And that might make it more
obvious what's happening: In the struct body, "Foo" refers to the alias, not
the templates.

You can refer to the templates with `.Foo`:

----
struct Foo(T)
{
    alias Foo = .Foo!(T, T.init);
}
struct Foo(T, T initialValue)
{
    private T value = initialValue;
}
Foo!int n;
----

--


More information about the Digitalmars-d-bugs mailing list