What exactly does "@safe" mean?

Peter Alexander peter.alexander.au at gmail.com
Sat Jun 1 14:50:53 PDT 2013


On Saturday, 1 June 2013 at 21:46:01 UTC, Maxim Fomin wrote:
> Updated example from above to show how @safe can introduce UB.
>
> void main() @safe
> {
>    int[4] y;
>    foo(y);
> }

I believe that's a compiler bug.

@safe requires:
- No taking the address of a local variable or function parameter.

A slice of a local static array should count as this, but it 
currently doesn't.


More information about the Digitalmars-d mailing list