WTF does "Enforcement failed" actually mean?
Russel Winder via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Oct 1 00:07:51 PDT 2015
On Wed, 2015-09-30 at 23:35 -0700, Ali Çehreli via Digitalmars-d-learn
wrote:
> On 09/30/2015 10:46 PM, Russel Winder via Digitalmars-d-learn wrote:
> > I have the code:
> >
> > reduce!"a+b"(x)
> >
> > where x is a int[] and I get an exception "Enforcement failed" at
> > run
> > time. This gives me enough information to say ¿que?
> >
>
> It's coming from the following no-message enforce():
>
> enforce(!r.empty);
>
>
> https://github.com/D-Programming-Language/phobos/blob/master/std/algo
> rithm/iteration.d#L2481
>
> You are using the no-seed version of reduce(), which uses the first
> element as seed, which means that the range cannot be empty.
Well that explanation (*) makes it abundantly clear that the error
reporting from this part of Phobos is distinctly substandard, let alone
below par.
(*) Which is clear and informative!
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20151001/1e80874e/attachment.sig>
More information about the Digitalmars-d-learn
mailing list