Missed scope guard statements

Gide Nwawudu gide at btinternet.com
Thu Mar 6 02:04:32 PST 2008


On Wed, 05 Mar 2008 16:26:27 -0500, Steve Jackson
<sjackso at cs.wisc.edu> wrote:

>(This is a report of what I believe is a "new" bug in the D compiler.  I'm not sure whether this newsgroup is the appropriate place to report such things, but it is the best I have been able to find.)
>
>While experimenting with scope guard statements, I came across some unexpected behavior.  This snippet:
>
>{
> if( true ){ scope(exit) writef("hello"); }
> writefln(" world" );
>}
>
>Produces the output "hello world", as I expected.  However, if I remove the if statement's braces, like so:
>
>{
> if( true ) scope(exit) writef("hello");
> writefln( " world" );
>}
>
>... then the first writef call is skipped entirely, and the output is " world".  No errors or compiler warnings are generated.
>
>I'm using the dmd compiler v2.010 on Linux.

Looks similar to this bug.

http://d.puremagic.com/issues/show_bug.cgi?id=1765

Gide


More information about the Digitalmars-d-bugs mailing list