Thread overview
[Issue 11211] Use of uninitialized struct allowed in a subclass
Jan 24, 2021
mhh
Jan 24, 2021
mhh
Jan 24, 2021
Max Samukha
Jan 24, 2021
mhh
January 24, 2021
https://issues.dlang.org/show_bug.cgi?id=11211

mhh <maxhaton@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |maxhaton@gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from mhh <maxhaton@gmail.com> ---
The struct is in a valid state

--
January 24, 2021
https://issues.dlang.org/show_bug.cgi?id=11211

mhh <maxhaton@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |LATER

--- Comment #2 from mhh <maxhaton@gmail.com> ---
-1 to me. It is however a language change to disallow this I think.

--
January 24, 2021
https://issues.dlang.org/show_bug.cgi?id=11211

Max Samukha <maxsamukha@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxsamukha@gmail.com

--- Comment #3 from Max Samukha <maxsamukha@gmail.com> ---
(In reply to mhh from comment #1)
> The struct is in a valid state

How is that? The default constructor is explicitly disabled to tell the compiler that the init state is *not valid* for that struct type (it is even dubbed "best practice" by p.6 of https://dlang.org/spec/struct.html#field-init).

--
January 24, 2021
https://issues.dlang.org/show_bug.cgi?id=11211

--- Comment #4 from mhh <maxhaton@gmail.com> ---
The invalid state thing was me misreading the test case, apologies.

I have brought up some kind of substrctural types in a meting so who knows if this behaviour may one day be properly fixed.

--