Bug 11212 – Use of uninitialized struct allowed 2

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-10-09T14:00:29Z
Last change time
2024-12-13T18:12:30Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
Max Samukha
Moved to GitHub: dmd#18691 →

Comments

Comment #0 by samukha — 2013-10-09T14:00:29Z
Related to issue 11211 struct S { @disable this(); bool cted; this(int x) { cted = true; } void foo() { assert(cted); } } void bar(A a) { a.s.foo(); } class A { S s; this() { bar(this); // shouldn't compile s = S(1); } } void main() { auto a = new A; } Passing 'this' outside the constructor should be disallowed before structs with disabled constructors are initialized. I could go on with bug reports but it is obvious that there is no good solution in the face of current compilation model.
Comment #1 by robert.schadek — 2024-12-13T18:12:30Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18691 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB