[Bug 29] undefined behaviour of: scope(...){ return X; }
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Thu Mar  9 17:44:18 PST 2006
    
    
  
http://d.puremagic.com/bugzilla/show_bug.cgi?id=29
------- Comment #2 from ddparnell at bigpond.com  2006-03-09 19:44 -------
But it *does* fail to compile now. For example, this program ...
-------------------
 import std.stdio;
 int Foo(int x)
 {
    scope(exit) if (x < 5) return x+9;
    return x;
 }
 void main()
 {
   for(int i = 0; i < 10; i++)
    writefln("IN %s OUT %s", i, Foo(i));
 }
-------------------
gives this compiler message ...
"test.d(4): return statements cannot be in finally bodies"
-- 
    
    
More information about the Digitalmars-d-bugs
mailing list