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.
Comment #2 by k.hara.pg — 2014-07-29T13:37:04Z
Comment #3 by github-bugzilla — 2014-07-31T02:36:46Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/dbcf7ac7ce8c3ce937cb21974eaaa748c041fdfd fix Issue 13223 - Cannot deduce argument for array template parameters This is a quick hack to support issue case. https://github.com/D-Programming-Language/dmd/commit/58306b8ccc088135ba5cf7a79289cdda87f4512a Merge pull request #3828 from 9rnsr/fix13223 [REG2.066a] Issue 13223 - Cannot deduce argument for array template parameters
Comment #4 by github-bugzilla — 2014-07-31T04:43:44Z
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a5f1c51e7d964ce8fea360bf1429654a67454305 Merge pull request #3828 from 9rnsr/fix13223 [REG2.066a] Issue 13223 - Cannot deduce argument for array template parameters
Comment #5 by github-bugzilla — 2014-08-22T08:05:12Z