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

2018-05-14 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18850

Jonathan Marler  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |INVALID

--- Comment #2 from Jonathan Marler  ---
Yes I made a mistake here.  Had a temporary brain lapse.  I mean to define Foo
as a template, not a templated struct.

--


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

2018-05-10 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18850

ag0aep6g  changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com

--- Comment #1 from ag0aep6g  ---
(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;


--