https://issues.dlang.org/show_bug.cgi?id=19183
--- Comment #8 from Atila Neves <atila.ne...@gmail.com> --- > @safe code can mess with it No it can't, that's the point of @safe. Mess with it how? > Why shouldn't this compile? There's no `scope` anywhere now (except maybe an > inferred one) Function template => inferred attributes => scope. But fine, this compiles and shouldn't: ---------- @safe: const(int)* gInts; void main() { auto s = MyStruct(); gInts = s.ptr; } struct MyStruct { int* ints; scope ptr(this This)() { return ints; } } ---------- > This makes sense to me. With `s` being `scope`, the compiler now checks it > and its contents don't leave `main`. Because, from DIP1000: A variable is inferred to be scope if it is initialized with a value that has a non-∞ lifetime. This very same code without a template this and instead manual instantiations of the three versions (mutable, const, immutable) doesn't compile _even_ if `auto` is used in the variable declaration. Furthermore, if `auto` was enough to get away from compiler checks, DIP1000 would be useless since nobody is going to remember to write `scope`. --