Bug 19012 – `scoped` crashes when instantiating an object with `alias this`
Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-06-21T17:00:57Z
Last change time
2019-12-27T08:33:25Z
Assigned to
No Owner
Creator
Никола Вукосављевић
Comments
Comment #0 by hauzer.nv — 2018-06-21T17:00:57Z
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
I see that in #5115 Dmitry Olshansky says that `scoped` is basically a failure 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);
}