[Issue 8589] Incorrect conversion of function returning `typeof(null)` to function returning an array
http://d.puremagic.com/issues/show_bug.cgi?id=8589 --- Comment #6 from Kenji Hara 2013-03-10 21:02:31 PDT --- (In reply to comment #5) > > Also this won't work because '[]' will be typed as 'void[]': > > That would be a type inference bug. Oh.. sorry, it is a today's limitation, not a bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8589] Incorrect conversion of function returning `typeof(null)` to function returning an array
http://d.puremagic.com/issues/show_bug.cgi?id=8589 --- Comment #5 from Kenji Hara 2013-03-10 20:55:04 PDT --- (In reply to comment #4) > Kenji, is this a parser bug? > > f(() => int[].init); > > test.d(11): Error: found '[' when expecting '.' following int > test.d(11): Error: found ']' when expecting identifier following 'int.' > > You have to use: > > f(() => (int[]).init); > > But that's not very convenient. No, it is not allowed in current grammar. So it is not a bug, but a limitation. > Also this won't work because '[]' will be typed as 'void[]': That would be a type inference bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8589] Incorrect conversion of function returning `typeof(null)` to function returning an array
http://d.puremagic.com/issues/show_bug.cgi?id=8589 Andrej Mitrovic changed: What|Removed |Added CC||andrej.mitrov...@gmail.com --- Comment #4 from Andrej Mitrovic 2013-03-10 16:36:13 PDT --- Kenji, is this a parser bug? f(() => int[].init); test.d(11): Error: found '[' when expecting '.' following int test.d(11): Error: found ']' when expecting identifier following 'int.' You have to use: f(() => (int[]).init); But that's not very convenient. Also this won't work because '[]' will be typed as 'void[]': f(() => []); But I guess we'll have to live with that for now.. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8589] Incorrect conversion of function returning `typeof(null)` to function returning an array
http://d.puremagic.com/issues/show_bug.cgi?id=8589 Walter Bright changed: What|Removed |Added Status|NEW |RESOLVED CC||bugzi...@digitalmars.com Resolution||FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8589] Incorrect conversion of function returning `typeof(null)` to function returning an array
http://d.puremagic.com/issues/show_bug.cgi?id=8589 --- Comment #3 from github-bugzi...@puremagic.com 2013-03-06 14:28:14 PST --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/043d6926ef4f3d0e8f25c1f0d69891bf7f39bdd1 fix Issue 8589 - Incorrect conversion of function returning `typeof(null)` to function returning an array https://github.com/D-Programming-Language/dmd/commit/f2b02836d7680aa3d1c92f2541c98638dcb0f0f9 Merge pull request #1119 from 9rnsr/fix8589 Issue 8589 - Incorrect conversion of function returning `typeof(null)` to function returning an array -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8589] Incorrect conversion of function returning `typeof(null)` to function returning an array
http://d.puremagic.com/issues/show_bug.cgi?id=8589 Kenji Hara changed: What|Removed |Added Keywords||pull --- Comment #2 from Kenji Hara 2012-09-16 04:06:36 PDT --- https://github.com/D-Programming-Language/dmd/pull/1119 Runtime representation of typeof(null) is same as void*, then delegate and dynamic array type should not be covariant with typeof(null). It's limitation. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8589] Incorrect conversion of function returning `typeof(null)` to function returning an array
http://d.puremagic.com/issues/show_bug.cgi?id=8589 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #1 from bearophile_h...@eml.cc 2012-08-26 04:38:12 PDT --- This compiles: f(() => null); This causes no assert to fire: foo(() => (int[]).init); While this doesn't even compile: foo(() => []); Error: function test.foo (int[] function() del) is not callable using argument types (void[] function() pure nothrow @safe) See also Issue 7007 Since lot of time in D dynamic arrays are not pointers, so generally accepting "null" as empty array literal is a wrong design decision, especially since the "[]" literal is available. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---