exceptions thrown by new / object constructor ?

Kagamin spam at here.lot
Mon Nov 1 12:17:11 PDT 2010


Michal Minich Wrote:

> What exceptions can be throw by object constructor / new expression? 
> Following code fails to compile because compiler says that both functions 
> foo and bar can throw.
> 
> class C {
>     nothrow this () {}
> }
>     
> nothrow void foo () {
>     auto c = new C;
> }
> 
> nothrow void bar () {
>     auto o = new Object;
> }

GC can throw OutOfMemoryException


More information about the Digitalmars-d-learn mailing list