[Issue 8843] New: Statically known slices given as fixed-size array arguments
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Oct 17 15:43:42 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8843
Summary: Statically known slices given as fixed-size array
arguments
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2012-10-17 15:43:41 PDT ---
void foo(ref int[4] data) {}
void bar(in ref int[4] data) {}
void main() {
auto a = new int[10];
foo(a[0 .. 4]);
bar(a[0 .. 4]);
}
dmd 2.061alpha shows that currently that code is not accepted:
test.d(5): Error: function test.foo (ref int[4u] data) is not callable using
argument types (int[])
test.d(5): Error: cannot implicitly convert expression (a[0u..4u]) of type
int[] to int[4u]
test.d(6): Error: function test.bar (ref const(int[4u]) data) is not callable
using argument types (int[])
test.d(6): Error: cannot implicitly convert expression (a[0u..4u]) of type
int[] to const(int[4u])
But I think that code is worth accepting, when the slice width is known at
compile-time.
See also Issue 8838
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list