Proposal: Treat static assert in template as instantiation error

Rioshin an'Harthen rharth75 at hotmail.com
Tue Aug 29 00:09:25 PDT 2006


"Kirk McDonald" <kirklin.mcdonald at gmail.com> wrote in message 
news:ecvn03$1nm5$1 at digitaldaemon.com...
> By throwing a static assert, the compiler aborts compilation immediately, 
> and the traceback information is lost. It is no longer obvious where the 
> template was originally instantiated from.
>
> I propose that if a static assert is thrown from within a template, that 
> it be treated as a failed template instantiation. This would (the hope is) 
> result in the instantiation traceback being printed out. It would allow 
> coders to explicitly cause their templates to fail in a way that is 
> informative: Users would get both the message in the static assert as well 
> as the traceback information. I am sure this would be a great boon to 
> anyone writing or using template code.

vote++ 





More information about the Digitalmars-d mailing list