Thread overview | ||||||
---|---|---|---|---|---|---|
|
January 20, 2013 [Issue 9363] New: Array slice initialization with implicitly castable type | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9363 Summary: Array slice initialization with implicitly castable type Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2013-01-20 15:36:26 PST --- This code works: import std.typecons: Typedef; alias Typedef!(int[]) MyArray; void main() { MyArray arr; arr.length = 10; arr[] = 0; } While this: import std.typecons: Typedef; alias Typedef!(ubyte[]) MyArray; void main() { MyArray arr; arr.length = 10; arr[] = 0; } Gives (dmd 2.062alpha): ...\dmd2\src\phobos\std\typecons.d(2811): Error: cannot implicitly convert expression (v) of type int to ubyte[] temp.d(6): Error: template instance std.typecons.Typedef!(ubyte[], null).Typedef.Proxy!(Typedef_payload).opSliceAssign!(Typedef!(ubyte[], null), int) error instantiating -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 21, 2013 [Issue 9363] Array slice initialization with implicitly castable type | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=9363 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com Platform|x86 |All OS/Version|Windows |All --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-21 07:36:05 PST --- std.typecons.Proxy is really poorly designed. Essentially every possible operator is shoved in there without doing any sort of check on what is being wrapper (except for the one check for classes). Btw please don't use the Platform field unless it's a platform-specific bug, thanks. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 21, 2013 [Issue 9363] Array slice initialization with implicitly castable type | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=9363 --- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-21 07:36:32 PST --- (In reply to comment #1) > wrapper I mean wrapped. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 21, 2013 [Issue 9363] Array slice initialization with implicitly castable type | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=9363 --- Comment #3 from bearophile_hugs@eml.cc 2013-01-21 09:15:34 PST --- (In reply to comment #1) > Btw please don't use the Platform field unless it's a platform-specific bug, thanks. The Platform tag was set to Windows because the error message that I have put here comes from Windows. It doesn't mean it's a Windows-only problem. -- 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