[Issue 18598] cyclic constructor calls have undefined behavior but are accepted in @safe code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 9 15:01:37 UTC 2023


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #5 from RazvanN <razvan.nitu1305 at gmail.com> ---
Well, infinite recursion also leads to a segfault due to stack overflow however
it is still accepted in @safe code [1]. @safe typically refers to undefined
behavior caused by memory corruption. I don't see any memory corruption
happening here, since the OS guards against that, rather a programming mistake
that is beyond of what the @safe checking mechanism can discover.

[1]  void fun() @safe { fun();

--


More information about the Digitalmars-d-bugs mailing list