Thread overview | |||||
---|---|---|---|---|---|
|
August 27, 2019 [Issue 20171] [REG 2.086.0] null this in invariant after destructor called | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20171 Simen Kjaeraas <simen.kjaras@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |contracts CC| |simen.kjaras@gmail.com Summary|[REG 2.086.0] Calling |[REG 2.086.0] null this in |public function from the |invariant after destructor |destructor segfaults |called --- Comment #1 from Simen Kjaeraas <simen.kjaras@gmail.com> --- Reduced example: struct S(T) { invariant (&this != null); ~this() { fun(); } void fun() { int i; } void opEquals(T)(T t) if (false) { } } unittest { S!int a; } As the changed summary indicates, `this` is null in the invariant. It is not null in ~this() or in fun(). opEquals() is of course never instantiated, but it needs to be there - it needs to have a template constraint, and it needs to take at least one argument, which needs to have a name, and needs to be of the type in the template parameter list. The invariant is called after fun(), so fun() needs to be there. It can't be empty, but it obviously doesn't need to do anything sensible. -- |
December 17, 2022 [Issue 20171] [REG 2.086.0] null this in invariant after destructor called | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20171 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |regression -- |
April 18, 2023 [Issue 20171] [REG 2.086.0] null this in invariant after destructor called | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20171 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1305@gmail.com Resolution|--- |WORKSFORME --- Comment #2 from RazvanN <razvan.nitu1305@gmail.com> --- I cannot reproduce the segfault. Compiling and running both the original code snippet and the reduced one result in successful compilation and run. -- |
Copyright © 1999-2021 by the D Language Foundation