www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11489] New: Improper implicit cast to immutable.

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

           Summary: Improper implicit cast to immutable.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: shammah.chancellor gmail.com



2013-11-09 12:23:37 PST ---
import std.stdio;

class Hmm
{
    int Hmmor;    
}

class A {
    Hmm bar;
}

class Foo : A { 
    this( Hmm _bar) pure
    {
        bar = _bar;
    }
} 

void sendA(immutable A input)
{

}

void sendFoo(immutable Foo input)
{

}

void main()
{
    auto wat = new Hmm();
    sendA( new Foo(wat));
}

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 09 2013
next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11489


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



13:27:13 PST ---
I think this is a feature:

http://dlang.org/changelog.html#uniqueinference

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 09 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11489




2013-11-09 20:34:29 PST ---
In this case it's a bug, because I have a non-unique non-immutable pointer to
Bar still in main().  I removed it by accident, but sendFoo( new Foo() ); is
still an error.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 09 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11489


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid, pull



Interestingly it is not related to unique object construction.

Reduced test case:

class A {}
class Foo : A {}
void main()
{
    immutable A a = new Foo();
}

Compiler fix:
https://github.com/D-Programming-Language/dmd/pull/2749

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11489




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/c08bf5ac3de0c51bb51995f937309b6bd4585e1d
fix Issue 11489 - Improper implicit cast to immutable.

https://github.com/D-Programming-Language/dmd/commit/f7d419a06901923d47bc0cf9b19d22bbb2d3ef2f


Issue 11489 - Improper implicit cast to immutable.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11489


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2013
prev sibling parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=11489




Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/8cf0263f036e35b821fabd893dde036cf271feb9
fix Issue 11489, add cast from const(LocalTime) to immutable

https://github.com/D-Programming-Language/phobos/commit/f842dac701fcd364e2f2ae9ec1141ba5a9a894cc


fix Issue 11489, add cast from const(LocalTime) to immutable

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 12 2013