April 16, 2005 Erroneous warning when returning a member of an auto instance with a destructor | ||||
---|---|---|---|---|
| ||||
If you compile this program with warnings *on* using DMD version 0.121: // auto class testClass { int flag; this() { flag = 50; } ~this() { } }; int main() { auto testClass t = new testClass; return t.flag; } // DMD gives you the following warning: // warning - testmain.d(15): function testmain.main no return at end of function // If you change testClass to no longer be auto, or you remove the destructor, DMD does not emit the warning. Y'know, it'd sure be nice if "-w" meant "generate warnings but continue if there are no *errors*." Right now it stops dead if it hits a warning, which I think is a bit wonky. -- /larry/ |
Copyright © 1999-2021 by the D Language Foundation