digitalmars.D.bugs - [Issue 2056] New: Const system does not allow certain safe casts/conversions involving deep composite types
- d-bugmail puremagic.com Apr 28 2008
- d-bugmail puremagic.com May 28 2008
- d-bugmail puremagic.com Nov 17 2010
- d-bugmail puremagic.com Nov 17 2010
- d-bugmail puremagic.com Nov 18 2010
- d-bugmail puremagic.com Nov 18 2010
- d-bugmail puremagic.com Nov 19 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2056 Summary: Const system does not allow certain safe casts/conversions involving deep composite types Product: D Version: 2.013 Platform: PC OS/Version: Windows Status: NEW Keywords: rejects-valid Severity: critical Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: brunodomedeiros+bugz gmail.com Const system does not allow certain safe casts/conversions involving deep composite types. In the following example, all casts should be allowed. ---- void testcases() { int[][] intArrayArray; int[][][] intArrayArrayArray; const(int)[][] f1 = intArrayArray; // Error here const(int[])[] f2 = intArrayArray; const(int)[][][] g1 = intArrayArrayArray; // Error here const(int[])[][] g2 = intArrayArrayArray; // Error here const(int[][])[] g3 = intArrayArrayArray; } --
Apr 28 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2056 ------- Comment #1 from brunodomedeiros+bugz gmail.com 2008-05-28 16:09 ------- I'm not sure if I should open a new bug or not, but since this one is still open, I'll put it here. The array cases seem to be fixed in DMD 2.14, but the very same problem still exists with pointer types, for example: void testcases() { int** intPtrPtr; int*** intPtrPtrPtr; const(int)** h1 = intPtrPtr; // Error here const(int*)* h2 = intPtrPtr; const(int)*** i1 = intPtrPtrPtr; // Error here const(int*)** i2 = intPtrPtrPtr; // Error here const(int**)* i3 = intPtrPtrPtr; } Similar issues also exist for associative arrays. --
May 28 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2056 Bruno Medeiros <bdom.pub+deebugz gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID --- Comment #2 from Bruno Medeiros <bdom.pub+deebugz gmail.com> 2010-11-17 12:15:17 PST --- The latest DMD compiles both code samples now, *however*, I've come to realize that in fact this code should NOT be allowed (that is, any of the "Error here" lines in the code above should produce an error), because these casts are actually not safe. For the reasons why, see bug #2544 , which is the inverse of this one. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 17 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2056 --- Comment #3 from Sobirari Muhomori <dfj1esp02 sneakemail.com> 2010-11-17 14:21:51 PST --- So this is a regression? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 17 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2056 --- Comment #4 from Bruno Medeiros <bdom.pub+deebugz gmail.com> 2010-11-18 04:06:29 PST --- A regression? Not exactly. When this bug was submitted, the lines marked with "// Error here" did not compile, and that was the "bug" that was reported. At some point DMD was changed so that the first, and later both code samples above compiled without errors. (I don't know if it was because Walter tried to fix this "bug" specifically, or if it was due to some other DMD changes). So this "bug" became fixed, but as I found after seeing #2544, this "bug" is actually invalid, and should not have been fixed in the first place. ( For curiosity, it would only be valid if immutable did not exist, or more precisely, if T was the only subtype of const(T) ) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 18 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2056 --- Comment #5 from Sobirari Muhomori <dfj1esp02 sneakemail.com> 2010-11-18 12:11:28 PST ---When this bug was submitted, the lines marked with "// Error here" did not compile
So what does the fix for bug 3621, I wonder? (It's for dmd 2.038) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 18 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2056 --- Comment #6 from Bruno Medeiros <bdom.pub+deebugz gmail.com> 2010-11-19 15:20:41 PST --- (In reply to comment #5)When this bug was submitted, the lines marked with "// Error here" did not compile
So what does the fix for bug 3621, I wonder? (It's for dmd 2.038)
I don't know. The code sample in #3621 still compiles ok, so maybe it was a mistake from Walter's part, and the bug is not really fixed. Just like #2544 is not fixed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 19 2010









d-bugmail puremagic.com 