www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19012] New: `scoped` crashes when instantiating an object

https://issues.dlang.org/show_bug.cgi?id=19012

          Issue ID: 19012
           Summary: `scoped` crashes when instantiating an object with
                    `alias this`
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: hauzer.nv gmail.com

Steps to reproduce: Run https://run.dlang.io/is/etSXLW
Actual results: Crashes with SIGSEGV.
Expected results: Program runs successfully.
Build: DMD64 D Compiler v2.080.1-dirty on Arch Linux 4.17.2-1-zen x86_64


and should be officially deprecated in favor of `scope`. Is that true? Note
that I'm a D newbie, so I'm treading on very new ground here.

Code from the link above, for completeness:

import std.typecons;

class A {
    int a;
    alias a this;

    this(const int a) {
        this.a = a;
    }
}

void main() {
    auto a = scoped!A(0);
}

--
Jun 21 2018