Bug 15243 – rejects-valid on variadic

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-10-24T09:49:20Z
Last change time
2017-12-18T22:58:06Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Sebastien Alaiwan

Comments

Comment #0 by ace17 — 2015-10-24T09:49:20Z
This code won't compile: class E(Types...) { void apply(U)(U delegate(Types[0]) f0) { } } void test() { E!int e; int f(int) { return 0; } e.apply(&f); } ace@ANTEC:~/projects/bugs/dmd$ dmd -c rejectsvalid1.d rejectsvalid1.d(15): Error: template rejectsvalid1.E!int.E.apply cannot deduce function from argument types !()(int delegate(int _param_0)), candidates are: rejectsvalid1.d(4): rejectsvalid1.E!int.E.apply(U)(U delegate(Types[0]) f0) However, one can make it compile by introducing an alias: class E(Types...) { alias Types[0] T0; void apply(U)(U delegate(T0) f0) { } } I'm using DMD64 D Compiler v2.068.2
Comment #1 by k.hara.pg — 2016-03-25T18:39:25Z
Comment #2 by github-bugzilla — 2017-12-07T15:27:15Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/8d719d66c86d52923ffba516ef2a78a1c2b71b92 Fix Issue 15243 - rejects-valid on variadic https://github.com/dlang/dmd/commit/353cc41ce88a43ccd8b7cbed364ea3129e647afb Merge pull request #7403 from JinShil/fix_15243 Fix Issue 15243 - rejects-valid on variadic merged-on-behalf-of: Mike Franklin <[email protected]>
Comment #3 by github-bugzilla — 2017-12-18T22:58:06Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/8d719d66c86d52923ffba516ef2a78a1c2b71b92 Fix Issue 15243 - rejects-valid on variadic https://github.com/dlang/dmd/commit/353cc41ce88a43ccd8b7cbed364ea3129e647afb Merge pull request #7403 from JinShil/fix_15243