New hash

Timon Gehr timon.gehr at gmx.ch
Sat Mar 24 04:44:10 PDT 2012


On 03/24/2012 03:39 AM, H. S. Teoh wrote:
> On Sat, Mar 24, 2012 at 02:39:35AM +0100, Andrej Mitrovic wrote:
>> I thought I'd open this topic for discussion of issues with the new
>> hash implementation.
> [...]
>
> Another issue:
>
> 	AA!(string,int[]) aa;
> 	auto x = aa.get("abc", []);
>
> This fails to compile, because the compiler deduces the type of [] as
> void[], and aa.get() doesn't know how to assign void[] to int[].
>
> The problem is that aa.get() is a template function,

It shouldn't be.

> so the usual
> implicit type deduction doesn't work. Here's a reduced version of the
> same problem:
>
> 	int[] func1(int dummy, int[] x) { return x; }
> 	int[] func2(T)(T dummy, int[] x) { return x; }
> 	void main() {
> 		auto x = func1(1, []);	// OK: [] deduced as int[]
> 		auto y = func2(1, []);	// Error: [] deduced as void[],
> 					// no matching templates found.
> 	}
>
>
> T
>

http://d.puremagic.com/issues/show_bug.cgi?id=7007


More information about the Digitalmars-d mailing list