Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
November 12, 2011 [Issue 6940] New: immutable(int*)* and int** do not combine | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6940 Summary: immutable(int*)* and int** do not combine Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: timon.gehr@gmx.ch --- Comment #0 from timon.gehr@gmx.ch 2011-11-12 13:34:54 PST --- immutable(int*)* and int** do not combine even though const(int*)* would be a common type: immutable(int*)* x; int** y; static assert(is(typeof(x) : const(int*)*)); // ok static assert(is(typeof(y) : const(int*)*)); // ok static assert(is(typeof(1?x:y))); // fail Compare to dynamic arrays: immutable(int[])[] a; int[][] b; static assert(is(typeof(a) : const(int[])[])); // ok static assert(is(typeof(b) : const(int[])[])); // ok static assert(is(typeof(1?a:b))); // ok (why on earth do the two cases use different logic?) Therefore the following could be used as a workaround: static assert(is(typeof((1?x[0..1]:y[0..1]).ptr))); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 17, 2011 [Issue 6940] immutable(int*)* and int** do not combine | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=6940 --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2011-11-16 19:44:01 PST --- > static assert(is(typeof(x) : const(int*)*)); // ok > static assert(is(typeof(a) : const(int[])[])); // ok I think these two lines should not compile. They are the part of bug 4251. Then, Both two cases should not have common type, IMO. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 17, 2011 [Issue 6940] immutable(int*)* and int** do not combine | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=6940 --- Comment #2 from timon.gehr@gmx.ch 2011-11-17 11:40:16 PST --- (In reply to comment #1) > > static assert(is(typeof(x) : const(int*)*)); // ok > > > static assert(is(typeof(a) : const(int[])[])); // ok > > I think these two lines should not compile. > They are the part of bug 4251. > > Then, Both two cases should not have common type, IMO. No, they are not part of bug 4251. This bug report is valid. This is bug 4251: immutable(int)** x; immutable(int)[][] y; static assert(is(typeof(x): const(int)**)); static assert(is(typeof(y): const(int)[][])); Consider this: immutable(int)** x; int y; // we now make *x point to y, even though y is not immutable: const(int)** p = x; // bug 4251 *p=&y; // since p == x, this assigns &y to *x That only works because immutable converted to const _two references deep_. None of that is going on here, consider this: immutable(int*)* x int y; // we now try to do the same thing const(int*)* p = x; // assume this works *p = y; // error! -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 18, 2011 [Issue 6940] immutable(int*)*/immutable(int)** and int** do not combine | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=6940 timon.gehr@gmx.ch changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|immutable(int*)* and int** |immutable(int*)*/immutable( |do not combine |int)** and int** do not | |combine --- Comment #3 from timon.gehr@gmx.ch 2011-11-18 13:35:48 PST --- immutable(int)** and int** should also combine to const(int*)* -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 19, 2011 [Issue 6940] immutable(int*)*/immutable(int)** and int** do not combine | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=6940 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch, rejects-valid --- Comment #4 from Kenji Hara <k.hara.pg@gmail.com> 2011-12-19 07:11:36 PST --- https://github.com/D-Programming-Language/dmd/pull/571 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 20, 2011 [Issue 6940] immutable(int*)*/immutable(int)** and int** do not combine | ||||
---|---|---|---|---|
| ||||
Posted in reply to timon.gehr@gmx.ch | http://d.puremagic.com/issues/show_bug.cgi?id=6940 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2011-12-20 13:03:08 PST --- https://github.com/D-Programming-Language/dmd/commit/06fe1ce97ef56cb86821114024c55f8d5fe0073c -- 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