Destructor called while object is still alive
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Fri Oct 23 22:07:51 UTC 2020
Not the prettiest or fastest trick, but the following code will
prevent the end of the scope being viewed as unreachable. You
could do a lot better with just loading a 1 into a register using
machine language. Probably something else you can test in the
standard library that the compiler does not have access to.
auto nevernull = malloc(1);
if (nevernull != null){
free(nevernull);
while(1){…};
}
// this is no longer viewed as unreachable
More information about the Digitalmars-d
mailing list