Hi all,

I want to make an opaque type that simply contains an integer with some immutable constants and toString pretty printing. Like this:

struct Foo_t
{
   private long foo;
   alias foo this;
   static immutable long Inf = long.max; //1)

   void toString(...){}
}

On dmd 2.092.1 this fails with:
1) Error: cannot implicitly convert expression 9223...L of type immutable(long) to Foo_t

I simply want to initialize an immutable long with long.max.
Why the conversion to Foo_t ?

If I add a constructor:
private this(long f)
{
   foo = f;
}

It compiles but according to code coverage this constructor is never called.
What's going on?

Reply via email to