Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
March 15, 2012 [Issue 7713] New: lambda inference doesn't work on template function argument | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7713 Summary: lambda inference doesn't work on template function argument Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: k.hara.pg@gmail.com --- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-15 01:58:13 PDT --- test case: ---- void foo(T)(T delegate(in Object) dlg) {} void main() { foo( (in obj) { return 15; } ); // line 6 } output: ---- test.d(6): Error: template test.foo(T) does not match any function template declaration test.d(6): Error: template test.foo(T) cannot deduce template function from argument types !()(void) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 16, 2012 [Issue 7713] lambda inference doesn't work on template function argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=7713 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-15 21:50:30 PDT --- https://github.com/D-Programming-Language/dmd/pull/814 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 16, 2012 [Issue 7713] lambda inference doesn't work on template function argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=7713 Alex Rønne Petersen <xtzgzorex@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |xtzgzorex@gmail.com --- Comment #2 from Alex Rønne Petersen <xtzgzorex@gmail.com> 2012-03-15 21:56:53 PDT --- Question: Would this also allow: void foo(T)(T t, bool delegate(T) dg) { } void main() { foo(1, (i) { return true; }); } or is it limited to the return type of the delegate (or is this completely unrelated to this bug?)? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 16, 2012 [Issue 7713] lambda inference doesn't work on template function argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=7713 --- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2012-03-15 22:49:51 PDT --- (In reply to comment #2) > Question: Would this also allow: > > void foo(T)(T t, bool delegate(T) dg) > { > } > > void main() > { > foo(1, (i) { return true; }); > } > > or is it limited to the return type of the delegate (or is this completely > unrelated to this bug?)? This is unrelated bug, and your sample is NEVER compiled. Because each parameter type inference runs in *parallel*. [1] T is deduced from argument 1 -> T is deduced to int, OK. [2] bool delegate(T) is deduced from argument (i) { return true; } -> Before template parameter type deduction, the delegate parameter i is deduced to T from template function parameter type, but T is not a real type. Then compiler cannot determine the delegate literal type. [1] succeeded but [2] failed, so whole IFTI would fail. The point is [1] and [2] runs in parallel, so they have no dependency. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 16, 2012 [Issue 7713] lambda inference doesn't work on template function argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=7713 --- Comment #4 from Alex Rønne Petersen <xtzgzorex@gmail.com> 2012-03-15 22:54:41 PDT --- That makes sense. Thank you for the explanation. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 20, 2012 [Issue 7713] lambda inference doesn't work on template function argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=7713 --- Comment #5 from github-bugzilla@puremagic.com 2012-03-20 14:12:18 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/8dba679462b3ee58bb589aa7a6b28135191c09be Merge pull request #814 from 9rnsr/fix7713 Issue 7713 - lambda inference doesn't work on template function argument -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 21, 2012 [Issue 7713] lambda inference doesn't work on template function argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to Kenji Hara | http://d.puremagic.com/issues/show_bug.cgi?id=7713 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation