My favourite game: DMD guess the error reason.

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon May 2 09:24:40 PDT 2016


On 5/2/16 3:13 AM, Iain Buclaw wrote:
> Here's a small puzzle, in which there are both a simple and cryptic
> combined. To make it easier, I've added a some multiple choice answers
> at the bottom.
>
> Winner of the simple puzzle gets a free beer from me at dconf.
> Winner of the cryptic puzzle gets a free meal.
>
>
> Q: What is the explanation for this error when building std.bigint?
> ---
> $ aarch64-linux-gnu-gdc -o std/bigint.o -Wall -Werror -g -frelease -O2
> -nostdinc -pipe -Wno-deprecated -c std/bigint.d
>
> std/uni.d:2627:50: error: template std.algorithm.searching.countUntil
> cannot deduce function from argument types !("a[0] >
> 0x80")(CodepointInterval[]), candidates are:
> std/algorithm/searching.d:684:11: note:
> std.algorithm.searching.countUntil(alias pred = "a == b", R, Rs...)(R
> haystack, Rs needles) if (isForwardRange!R && Rs.length > 0 &&
> isForwardRange!(Rs[0]) == isInputRange!(Rs[0]) &&
> is(typeof(startsWith!pred(haystack, needles[0]))) && (Rs.length == 1 ||
> is(typeof(countUntil!pred(haystack, needles[1..__dollar])))))
> std/algorithm/searching.d:772:11: note:
> std.algorithm.searching.countUntil(alias pred = "a == b", R, N)(R
> haystack, N needle) if (isInputRange!R &&
> is(typeof(binaryFun!pred(haystack.front, needle)) : bool))
> std/algorithm/searching.d:841:11: note:
> std.algorithm.searching.countUntil(alias pred, R)(R haystack) if
> (isInputRange!R && is(typeof(unaryFun!pred(haystack.front)) : bool))
> std/uni.d:1853:29: error: template instance
> std.uni.InversionList!(GcPolicy) error instantiating
> ---
>
> A:
> ---
> [1]: Template deduction/matching failed to find a suitable candidate for
> countUntil.

This answer is trivially true. It even says so in the error message :)

What I assume you mean is that one *should* match but there is a bug in 
the matching mechanism? I'd say no -- this would be too easy an answer

> [2]: The ptrdiff_t and size_t types have a different size.

Wow, it would be a copy-paste error of some sort? An interesting 
possibility. But I'm going to say no, I don't see how this comes into 
play for the template constraints.

> [3]: An untested version path had a semantic error.

This is a possibility, but not very likely (in terms of errors that are 
prone to occur).

> [4]: An untested template instantiation had a missing member.

This has my vote. I've had this bite me many times...

> [5]: The template function core.varargs.va_arg does not exist.

haha!

> [6]: A static assert was triggered in std.math.

No, but again possible. If this is the problem, it comes down to the 
issues with is(typeof(some code)) that have been discussed lately.

> [7]: The std.format module does not support 128-bit reals.

I'd say no, because I don't see how it relates to the error messages.

> [8]: The compiler didn't add a predefined version for little/big endian.

ugh. How are we to guess at your environment? ;) I'd say no.

> [9]: The order that modules are imported on AArch64 unearthed a bug in
> the semantic pass.

Possible. Still going with 4.

-Steve


More information about the Digitalmars-d mailing list