Created
September 30, 2013 02:47
-
-
Save tom-tan/6758818 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env rdmd | |
import std.conv; | |
import std.exception; | |
version(unittest) {} | |
else | |
void main() | |
{ | |
// Error: static assert "The error handler's return value(void) does not have a common type with the expression(int)." | |
int x = "x".to!int.ifThrown!ConvException((e) { | |
throw new Exception("throwing another exception"); | |
}); | |
// こっちは動く | |
int y = "y".to!int.ifThrown!ConvException((e) { | |
throw new Exception("throwing another exception"); | |
return int.init; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment