www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 926] New: Implicit conversion from Derived[] to Base[]

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=926

           Summary: Implicit conversion from Derived[] to Base[]
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: csantander619 gmail.com


In
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=47590,
Kan noted that this was again allowed:

class A {}
class B : A {}

void main()
{
        B [] b;
        A [] a = b;
}

I don't know if the docs mention it, but it seems to have been re-allowed out
of the blue.


-- 
Feb 03 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=926


thomas-dloop kuehne.cn changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from thomas-dloop kuehne.cn  2007-04-05 11:33 -------
http://www.digitalmars.com/d/arrays.html

 
 A dynamic array T[] can be implicitly converted to one of the following:
 
    * U[]
    * void[]

 Where U is a base class of T.
--
Apr 05 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=926


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
             Status|RESOLVED                    |REOPENED
          Component|DMD                         |www.digitalmars.com
         Resolution|INVALID                     |
            Summary|Implicit conversion from    |Revival of implicit
                   |Derived[] to Base[]         |conversion from Derived[] to
                   |                            |Base[] not noted in
                   |                            |changelog




------- Comment #2 from smjg iname.com  2009-02-24 09:30 -------
So the bug is that either:
(a) It was disallowed in 0.73 according to the changelog, but the spec itself
not updated.  The 'bug' that it didn't behave according to spec was
subsequently fixed, but Walter completely forgot about the time when the
anomaly was introduced.

(b) It was disallowed in 0.73, the spec updated, and then the reversion both in
the spec and in the compiler was inadvertently left out of the changelog.


-- 
Feb 24 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=926


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P5
                 CC|                            |andrei metalanguage.com
            Version|unspecified                 |D2
         AssignedTo|nobody puremagic.com        |bugzilla digitalmars.com
           Severity|normal                      |critical


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=926


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P5                          |P2
            Version|D2                          |unspecified
           Severity|critical                    |normal


--- Comment #3 from Stewart Gordon <smjg iname.com> 2011-01-08 15:26:39 PST ---
The version, priority and severity changes just made make no sense at all.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=926


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unspecified                 |D1
           Severity|normal                      |enhancement


--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2012-01-29
02:10:38 PST ---
This is D1 only. D2 does not allow it.

The D1 spec allows it, and changing it would be an enhancement.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 29 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=926


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|accepts-invalid             |
           Severity|enhancement                 |normal


--- Comment #5 from Stewart Gordon <smjg iname.com> 2012-01-29 07:15:47 PST ---
The D1 spec allows what?

The spec and the changelog to contradict each other?

In which DMD version was this misfeature revived, anyway?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 29 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=926


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |WONTFIX


--- Comment #6 from Walter Bright <bugzilla digitalmars.com> 2012-01-29
10:29:25 PST ---
(In reply to comment #5)
 The D1 spec allows what?
It allows implict conversion of an array of derived classes to an array of base classes. Thomas quoted the relevant verbage.
 The spec and the changelog to contradict each other?
What matters is what the spec says and what the compiler does now. If someone wants to go through the compiler/spec diffs from years ago to see when things changed, that's fine and I'll fold in changelog changes if they present them, but I've got a lot of current issues to address, and historical spelunking is off the radar.
 In which DMD version was this misfeature revived, anyway?
I don't know. I agree it is a misfeature, but I am loathe to break existing D1 code at this point, so I believe it should stay as it is. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 29 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=926


Stewart Gordon <smjg iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |
         AssignedTo|bugzilla digitalmars.com    |smjg iname.com


--- Comment #7 from Stewart Gordon <smjg iname.com> 2012-01-30 08:55:26 PST ---
(In reply to comment #6)

 What matters is what the spec says and what the compiler does now. If someone
 wants to go through the compiler/spec diffs from years ago to see when things
 changed, that's fine and I'll fold in changelog changes if they present them,
The standard meaning of WONTFIX is "this issue is to stay as it is" not "I personally can't be bothered/don't have time to deal with it". The way to indicate the latter is to leave it open and reassign it to nobody - this shows that it's free for anybody to take the issue and work on it. Here's an idea: I'll have a look at it myself over the next few days. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=926


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #8 from Walter Bright <bugzilla digitalmars.com> 2012-01-30
11:27:08 PST ---
(In reply to comment #7)
 Here's an idea: I'll have a look at it myself over the next few days.
I'll be happy to merge in any changes you suggest. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 30 2012