Bug 13223 – Cannot deduce argument for array template parameters
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-29T08:32:00Z
Last change time
2014-08-22T08:05:12Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
dragoscarp
Comments
Comment #0 by dragoscarp — 2014-07-29T08:32:46Z
Following code works with 2.065:
T[] foo(T)(T[] a1, T[] a2)
{
return a1 ~ a2;
}
void main()
{
int[] a = [1, 2];
assert(foo(a, []) == [1, 2]);
}
With 2.066.0-b6 it generates compile error:
template_deduction.d(9): Error: template template_deduction.foo cannot deduce function from argument types !()(int[], void[]), candidates are:
template_deduction.d(1): template_deduction.foo(T)(T[] a1, T[] a2)
Comment #1 by dragoscarp — 2014-07-29T08:37:11Z
T foo(T)(T a1, T a2)
{
return a1 ~ a2;
}
void main()
{
int[] a = [1, 2];
assert(foo(a, []) == [1, 2]);
}
This code (non array template types) works with 2.066.0-b6 and generates the previous described compile error with 2.065.