On 3/6/18 7:44 AM, Shachar Shemesh wrote:
On 06/03/18 14:00, Steven Schveighoffer wrote:
On 3/6/18 6:21 AM, Simen Kjærås wrote:
On Tuesday, 6 March 2018 at 10:03:54 UTC, Shachar Shemesh wrote:
void main() {
    struct S {
        uint value;

        ~this() {

    const S a = S(12);
    S b = a;

test.d(10): Error: cannot implicitly convert expression a of type const(S) to S

Looks like a bug to me - please file one in bugzilla.

Nope. It's not a bug. S contains a pointer, namely the context pointer for main.


Which does not explain why my code compiles if I remove the destructor.

If the struct is POD, there is no need to include the context pointer.

void main()
   struct POD { int x; }
   pragma(msg, POD.sizeof); // 4
   struct Nested { int x; void someMember() {} }
   pragma(msg, Nested.sizeof); // 16


Reply via email to