Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
September 21, 2022 [Issue 23354] [REG master] object.d(393): Error: reference to stack allocated value returned by 'new F(1)' assigned to non-scope parameter 'lhs' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23354 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |safe CC| |ibuclaw@gdcproject.org -- |
September 21, 2022 [Issue 23354] [REG master] object.d(393): Error: reference to stack allocated value returned by 'new F(1)' assigned to non-scope parameter 'lhs' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23354 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid -- |
September 21, 2022 [Issue 23354] [REG master] object.d(393): Error: reference to stack allocated value returned by 'new F(1)' assigned to non-scope parameter 'lhs' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23354 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=19812 -- |
September 21, 2022 [Issue 23354] [REG master] object.d(393): Error: reference to stack allocated value returned by 'new F(1)' assigned to non-scope parameter 'lhs' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23354 --- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> --- Test extracted from druntime. Fails with -preview=dip1000, succeeds with -preview=dip1000 -checkaction=context. --- /// If same exact type => one call to method opEquals /// This test passes `@safe` because it defines a new opEquals with `@safe` @safe void unittest1() { class F { int flag; this(int flag) { this.flag = flag; } bool opEquals(const F o) const @safe nothrow pure { return flag == o.flag; } } assert(new F(0) == new F(0)); assert(!(new F(0) == new F(1))); } /// General case => symmetric calls to method opEquals @safe void unittest2() { int fEquals, gEquals; class Base { int flag; this(int flag) { this.flag = flag; } } class F : Base { this(int flag) { super(flag); } bool opEquals(const Base o) @safe { fEquals++; return flag == o.flag; } } class G : Base { this(int flag) { super(flag); } bool opEquals(const Base o) @safe { gEquals++; return flag == o.flag; } } assert(new F(1) == new G(1)); assert(fEquals == 1); assert(gEquals == 1); } -- |
September 23, 2022 [Issue 23354] [REG master] object.d(393): Error: reference to stack allocated value returned by 'new F(1)' assigned to non-scope parameter 'lhs' | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=23354 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |REMIND --- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> --- Regression PR has been reverted https://github.com/dlang/dmd/pull/14463 This needs to be checked again when re-fixing issue 19812. -- |
Copyright © 1999-2021 by the D Language Foundation