Subclass TcpSocket?
    Steven Schveighoffer 
    schveiguy at gmail.com
       
    Tue Mar 18 18:04:12 UTC 2025
    
    
  
On Tuesday, 18 March 2025 at 07:42:37 UTC, Jonathan M Davis wrote:
> The base class constructors are not nothrow, so WrappedTCP's 
> constructor cannot be nothrow. There really isn't a way out of 
> that, because if a constructor throws, the object's state is 
> destroyed. So, catching and handling the Exception to make your 
> function nothrow isn't really an option like it would be with 
> many functions.
FWIW, this does compile:
```d
class A
{
     this() {}
}
class B : A
{
     this() nothrow {
         try {
             super();
         } catch(Exception e) {}
     }
}
```
Not sure if it should...
-Steve
    
    
More information about the Digitalmars-d-learn
mailing list