digitalmars.D.bugs - [Issue 4030] New: Better object array literal type inference
- d-bugmail puremagic.com (28/28) Mar 30 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4030
- d-bugmail puremagic.com (20/20) Aug 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4030
- d-bugmail puremagic.com (12/12) Aug 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4030
http://d.puremagic.com/issues/show_bug.cgi?id=4030
Summary: Better object array literal type inference
Product: D
Version: future
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: bearophile_hugs eml.cc
In the following D2 program the compiler can refuse the line 6, because it must
refuse to guess (if p1 is an array of A or B).
But at line 7 the compiler has enough information to not guess (it's an array
of A), so line 7 can be accepted by the compiler:
class A {}
class B : A {}
final class C1 : B {}
final class C2 : B {}
void main() {
auto p1 = [new C1, new C2]; // line 6, don't guess
A[] p2 = [new C1, new C2]; // line 7, no need to guess
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 30 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4030
klickverbot <code klickverbot.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |code klickverbot.at
---
There is an even shorter example which fails on DMD 2.048:
---
class A {}
class B {}
void main() {
Object[] foo = [ new A, new B ];
}
---
TDPL has: "The element type of the array is determined by agreement among all
elements of the array, which is computed by means of the conditional operator ?
: (anticipating § 2.3.16)."
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 28 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4030
nfxjfg gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |nfxjfg gmail.com
Resolution| |DUPLICATE
*** This issue has been marked as a duplicate of issue 3543 ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 28 2010









d-bugmail puremagic.com 