digitalmars.D.bugs - [Issue 4313] New: undefined identifier error with scope guard statement
- d-bugmail puremagic.com (26/26) Jun 14 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4313
- d-bugmail puremagic.com (13/13) Jun 14 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4313
- d-bugmail puremagic.com (18/23) Jan 30 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4313
http://d.puremagic.com/issues/show_bug.cgi?id=4313 Summary: undefined identifier error with scope guard statement Product: D Version: 2.041 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: mrmocool gmx.de import std.stdio; void main() { scope(exit) writeln(res); auto res = 0; } This compiles, but using failure or success in the scope guard statement gives "undefined identifier res". The question is, if this case is an accepts-invalid or if the other two cases are rejects-valid. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 14 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4313 Trass3r <mrmocool gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid Seems a bit strange. According to CompoundStatement::semantic this is rewritten as try-catch-finally. Even scope(exit) would have the auto res = 0 in the try block which would result in undefined identifier. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 14 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4313 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies gmail.com Version|2.041 |D1 & D2Seems a bit strange. According to CompoundStatement::semantic this is rewritten as try-catch-finally. Even scope(exit) would have the auto res = 0 in the try block which would result in undefined identifier.Because the declaration is nothrow, main's body becomes: { int res = 0; writeln(res); return 0; } But yes, this is a bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2012