bottom type as parameter or local variable, does that make sense?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Jan 17 18:40:55 UTC 2022


On Mon, Jan 17, 2022 at 06:11:09PM +0000, Paul Backus via Digitalmars-d wrote:
> On Monday, 17 January 2022 at 18:05:10 UTC, H. S. Teoh wrote:
> > On Mon, Jan 17, 2022 at 05:57:19PM +0000, Paul Backus via Digitalmars-d
> > wrote:
> > > 
> > > I think the best way to describe the behavior specified by the DIP
> > > is that the compiler rewrites
> > > 
> > >     noreturn x;
> > > 
> > > to
> > > 
> > >     noreturn x = void;
> > > 
> > > So, there is a special case here, but it does not require noreturn
> > > to have a default constructor.
> > 
> > The question then would be, why such a special case?  There's no
> > need to have a special case here, since aborting/terminating on
> > declaring a variable of type noreturn is perfectly reasonable
> > semantics for a bottom type.
> 
> Both the rewrite I describe and the behavior you propose are special
> cases.  The non-special-case behavior is "compile-time error."

OK, so it should be a compile-time error, then.


T

-- 
Try to keep an open mind, but not so open your brain falls out. -- theboz


More information about the Digitalmars-d mailing list