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


--- Comment #0 from Shammah Chancellor <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


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-11-09
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



--- Comment #2 from Shammah Chancellor <shammah.chancellor gmail.com>
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


--- Comment #3 from Kenji Hara <k.hara.pg gmail.com> 2013-11-12 06:17:20 PST ---
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



--- Comment #4 from github-bugzilla puremagic.com 2013-11-12 19:43:23 PST ---
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
Merge pull request #2749 from 9rnsr/fix11489

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



--- Comment #5 from github-bugzilla puremagic.com 2013-11-12 21:04:53 PST ---
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
Merge pull request #1689 from 9rnsr/fix11489

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