Seems like this is a CTFE-only issue?
No.

import std.stdio;
struct A
{
        int store;

        this(int a)
        {
                store = a << 3;
                //...
        }
}

// A a = 5; // Error: cannot implicitly convert expression (5) of type int to A

void foo(A a)
{
}

void main()
{
        A a = 5; // fine
        writeln(a.store); // prints 40

foo(5); // Error: cannot implicitly convert expression (5) of type int to A

}

Reply via email to