I'm glad throw is now an expression
Paul Backus
snarwin at gmail.com
Tue May 24 19:21:51 UTC 2022
On Sunday, 22 May 2022 at 13:56:54 UTC, Jesse Phillips wrote:
> I actually wanted, and forgot, to file a bug that you can no
> longer override a method with one marked with nothrow.
>
> Since it only adds restrictions and is compatible with a method
> that throws, I think it is a good choice to support like
> contraverience or whichever it is.
>
> Hmm I wonder if that works with const.
Do you have an example program that demonstrates this bug? The
following program works for me when compiled with DMD 2.100.0:
```d
class C
{
void fun() { throw new Exception("oops"); }
}
class D : C
{
override void fun() nothrow { }
}
void main()
{
D d = new D;
C c = new D;
d.fun(); // ok
c.fun(); // ok
}
```
More information about the Digitalmars-d
mailing list