Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 28, 2018 [Issue 19038] Cannot compare const(T)[][] and T[][] | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19038 ag0aep6g <ag0aep6g@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid CC| |ag0aep6g@gmail.com Hardware|x86_64 |All OS|Linux |All --- Comment #1 from ag0aep6g <ag0aep6g@gmail.com> --- >From a quick glance at the source, DMD might be rejecting comparisons of arrays that don't have a common type [1][2]. And apparently, it thinks that `Foo[][]` and `const(Foo)[][]` don't have a common type. But that's wrong. `const(Foo[])[]` is one. Another symptom of that possible root cause: ---- void main() { int[][] a1; const(int)[][] a2; const(int[])[] common; common = true ? a1 : a2; /* "Error: incompatible types" */ /* But: */ if (true) common = a1; else common = a2; /* correctly accepted */ /* So there is a common type. The ternary expression should be accepted. */ } ---- [1] https://github.com/dlang/dmd/blob/033d324957ff5bee8e25c7335eab2c562d17e2b1/src/dmd/expressionsem.d#L9059-L9066 [2] https://github.com/dlang/dmd/blob/033d324957ff5bee8e25c7335eab2c562d17e2b1/src/dmd/dcast.d#L3339-L3344 -- |
June 29, 2018 [Issue 19038] Cannot compare const(T)[][] and T[][] | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19038 --- Comment #2 from FeepingCreature <default_357-line@yahoo.de> --- Just casting both sides to const seems to work. https://github.com/dlang/dmd/pull/8413 -- |
December 17, 2022 [Issue 19038] Cannot compare const(T)[][] and T[][] | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19038 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
December 13 [Issue 19038] Cannot compare const(T)[][] and T[][] | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19038 --- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> --- THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19451 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB -- |
Copyright © 1999-2021 by the D Language Foundation