[Bug 29] undefined behaviour of: scope(...){ return X; }

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 9 22:46:38 PST 2006


http://d.puremagic.com/bugzilla/show_bug.cgi?id=29


thomas-dloop at kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Comment #3 from thomas-dloop at kuehne.cn  2006-03-10 00:46 -------
(In reply to comment #1)
> It shouldn't fail to compile. It means the same thing as a return inside a
> finally block. Not a bug.

The correlation wiht finally isn't documented.

http://www.digitalmars.com/d/statement.html#try
# A FinallyStatement may not exit with a goto, break, continue, or
# return; nor may it be entered with a goto.

Thus the code below is illegal, yet compiles:
# int test(){
#     scope(exit) return 0;
# }

# void test(){
#     scope(exit) return 0;
# }


-- 




More information about the Digitalmars-d-bugs mailing list