[Issue 19065] Struct invariant violated in @safe with T.init

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 12 22:30:55 UTC 2018


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

Ali Ak <ali.akhtarzada at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ali.akhtarzada at gmail.com

--- Comment #4 from Ali Ak <ali.akhtarzada at gmail.com> ---
(In reply to Walter Bright from comment #1)
> I think this change defeats the purpose of having an invariant. T.init is
> supposed to be a valid object, and so should pass the invariant.
> 
> It's not a bug, it's the way the language is designed to work.
> 
> To make this modification to the semantics, a fairly compelling use case
> will be required.

Does this mean the compile time constructed value of T must be a valid runtime
constructed value of T to be able to use invariants?

--


More information about the Digitalmars-d-bugs mailing list