| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
March 08, 2013 Throw in a pre-condition of a nothrow function | ||||
|---|---|---|---|---|
| ||||
Currently this code compiles:
void foo() nothrow
in {
throw new Exception(null);
} body {
}
void main() {
foo();
}
Then at runtime throws:
object.Exception@test.d(3)
---------
0x00402044 in nothrow void test.foo() at ...
...
Is this good? Isn't the "nothrow" tag used by the compiler to better optimize functions?
Bye,
bearophile
| ||||
March 08, 2013 Re: Throw in a pre-condition of a nothrow function | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | That's a bug. Interesting point here is whether it is a regression or not. | |||
March 08, 2013 Re: Throw in a pre-condition of a nothrow function | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | On Friday, 8 March 2013 at 19:39:47 UTC, bearophile wrote:
> Currently this code compiles:
[...]
Nice edge case to test the compiler with.
Definitely looks like a bug. It should not compile given the nothrow attrib.
If it was throwable, what to do about throwing a null reference is an interesting question.
--rt
| |||
March 08, 2013 Re: Throw in a pre-condition of a nothrow function | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Rob T | Rob T: > Definitely looks like a bug. It should not compile given the nothrow attrib. http://d.puremagic.com/issues/show_bug.cgi?id=9669 Bye, bearophile | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply