So these two compile and, in non-debug builds, run just fine
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Fri Nov 25 07:30:35 PST 2016
On 11/25/16 9:57 AM, Ethan Watson wrote:
@safe: // now it fails.
> MyClass* getAPointer()
> {
> MyClass* ptr;
> MyClass instance = new MyClass();
> ptr = &instance;
> return ptr;
> }
>
> MyStruct* getAnotherPointer()
> {
> MyStruct* ptr;
> MyStruct instance;
> ptr = &instance;
> return ptr;
> }
But I think Walter's scope changes (DIP 1001 I think?) will make it so
the compiler rejects this even in non-safe mode.
-Steve
More information about the Digitalmars-d
mailing list