[Issue 8838] Slicing static arrays should be considered unsafe (@system)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 17 16:57:57 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8838



--- Comment #5 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-10-17 16:57:55 PDT ---
> The code segment must be rejected, but what makes it unsafe is the escaping.
> Banning the slicing is not very precise.

It's exactly what happens with taking the address of a local variable. It's an
error if the compiler can determine that it's escaping, but it's @system
regardless. And because the compiler _can't_ guarantee that the reference isn't
escaping, it really has no choice but to make it @system to take the address or
slice in the first place. Doing otherwise would mean that it's possible to have
memory corruption issues when only using @safe code, which would be violating
@safe.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list