www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Trouble reproducing compilation error

reply "Xinok" <xinok live.com> writes:
I'm currently receiving several errors when trying to compile 
this code with DMD 2.066 (beginning with RC1):

https://github.com/Xinok/XSort

The compiler throws an error because it's unable to deduce a type 
for the predicate in a few places. This repository compiles just 
fine in DMD 2.065 and earlier (more specifically, 2.066 beta 5 
and earlier). I'm very certain that this is a bug given that I 
never experienced this issue before.

However, I'm finding it impossible to reproduce the bug so I can 
file a bug report. I'm not sure what exactly is causing it or if 
there's something specific in the context of this code that's 
triggering it. The only thing that I can deduce is that, in each 
case, an instance variable is being compared to an array element, 
e.g.:

     int[] arr = [10, 20, 30];
     int value = arr[0];
     pred(value, arr[1]); // Instance variable compared to array 
element

This one is stumping me and I could use some help in tracking 
down this bug.
Aug 21 2014
next sibling parent "Xinok" <xinok live.com> writes:
This is the full compiler output:

combsort.d(90): Error: template D main.pred cannot deduce
function from argument
   types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
benchsort.d(81): Error: template instance
combsort.combSortLinear!(pred, uint[])
   error instantiating
combsort.d(135): Error: template D main.pred cannot deduce
function from argumen
t types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
combsort.d(151): Error: template D main.pred cannot deduce
function from argumen
t types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
benchsort.d(82): Error: template instance
combsort.combSortGallop!(pred, uint[])
   error instantiating
forwardsort.d(218): Error: template D main.pred cannot deduce
function from argu
ment types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
forwardsort.d(138): Error: template D main.pred cannot deduce
function from argu
ment types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
forwardsort.d(52): Error: template D main.pred cannot deduce
function from argum
ent types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
benchsort.d(84): Error: template instance
forwardsort.forwardSort!(pred, uint[])
   error instantiating
heapsort.d(119): Error: template D main.pred cannot deduce
function from argumen
t types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
heapsort.d(102): Error: template D main.pred cannot deduce
function from argumen
t types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
benchsort.d(99): Error: template instance
heapsort.heapSort!(pred, false, uint[]
) error instantiating
heapsort.d(119): Error: template D main.pred cannot deduce
function from argumen
t types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
heapsort.d(102): Error: template D main.pred cannot deduce
function from argumen
t types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
benchsort.d(101): Error: template instance
heapsort.heapSort!(pred, true, uint[]
) error instantiating
heapsort.d(221): Error: template D main.pred cannot deduce
function from argumen
t types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
benchsort.d(103): Error: template instance
heapsort.bottomUpHeapSort!(pred, fals
e, uint[]) error instantiating
heapsort.d(221): Error: template D main.pred cannot deduce
function from argumen
t types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
benchsort.d(104): Error: template instance
heapsort.bottomUpHeapSort!(pred, true
, uint[]) error instantiating
insertionsort.d(45): Error: template D main.pred cannot deduce
function from arg
ument types !()(uint, uint), candidates are:
benchsort.d(37):        benchsort.main.pred(T)(T a, T b)
benchsort.d(108): Error: template instance
insertionsort.insertionSort!(pred, ui
nt[]) error instantiating
Aug 21 2014
prev sibling parent "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> writes:
I used Vladimir's digger on your code, this is the output:

442708214b84093fd79b1d37c927c6ef5f1aeb99 is the first bad commit
commit 442708214b84093fd79b1d37c927c6ef5f1aeb99
Author: Walter Bright <walter walterbright.com>
Date:   Wed Jul 23 03:59:13 2014 -0700



     https://github.com/D-Programming-Language/dmd/pull/3801

     [REG2.066a] Issue 13180 - AA get returns const(char[]) 
instead of string

:160000 160000 b4335c9d3eae1640d42e152894b2b9ec95d5828d 
a85f5d7aa43066e10db306f528c378786744e909 M	dmd

Vladimir noted in this PR that it introduced the following 
regression:
https://issues.dlang.org/show_bug.cgi?id=13294

I'm going to post a link to this discussion there.
Aug 22 2014