On 02/27/2018 09:59 PM, Radu wrote:
On Tuesday, 27 February 2018 at 20:51:25 UTC, ag0aep6g wrote:
On 02/27/2018 09:30 PM, Radu wrote:
[...]
enum Type { a };
struct S(Type t = Type.a)
{
this(Type)(Type t)
{
import std.stdio;
writeln("ctor called.");
}
}
[...]
So the bug is that somehow the templated version makes it so there is an
implicit void* ctor.
In your original code (quoted above), you've got a templated
constructor. The `Type` in `this(Type)(Type t)` is not the enum. It's a
template parameter of the constructor.
To get a non-templated constructor that takes a `Type` (the enum), you
have to write:
----
this(Type t) /* NOTE: Only one set of parentheses. */
{
/* ... */
}
----