www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9258] New: opAssign with base class triggers "identity assignment operator overload" error

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

           Summary: opAssign with base class triggers "identity assignment
                    operator overload" error
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: siegelords_abode yahoo.com


--- Comment #0 from siegelords_abode yahoo.com 2013-01-02 11:16:22 PST ---
This code worked fine on 2.060, but is broken on 2.061:

class B { }

class A : B // test.d(3): Error: class test.A identity assignment operator
overload is illegal
{
    void opAssign(B b)
    {
    }
}

Firstly, the error line is wrong. Secondly, the assignment is not an identity
assignment, as this, without the overload, does not compile:

A a;
B b;
a = b;

I interpret identity assignment to mean strictly assignment of one type to the
same type.

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


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-01-12
19:26:55 PST ---
Introduced by:

commit 9ee798f73a2f7765a68bbe8f40ff292f551dab72
Author: k-hara <k.hara.pg gmail.com>
Date:   Sat May 26 02:06:20 2012 +0900

    Relax opAssign signature.

    Class type that has identity opAssign is disallowed both it is templated or
not.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid


--- Comment #2 from Kenji Hara <k.hara.pg gmail.com> 2013-01-30 20:18:40 PST ---
https://github.com/D-Programming-Language/dmd/pull/1585

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



--- Comment #3 from github-bugzilla puremagic.com 2013-01-31 01:47:37 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1637248da9f358d6eb10f41e78c8268acbc4492a
fix Issue 9258 - opAssign with base class triggers "identity assignment
operator overload" error

https://github.com/D-Programming-Language/dmd/commit/b94fd3b7d2164ef1fc924265d4c5d04c7c673463
Merge pull request #1585 from 9rnsr/fix_assign

Issue 9258 & 9404 & 9416 - fix regressions around opAssign

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


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

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


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


siegelords_abode yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


--- Comment #4 from siegelords_abode yahoo.com 2013-02-21 20:10:52 PST ---
Turns out this fix is incomplete. This code is still broken:

class B
{
}

class A : B
{
    alias set opAssign;

    void set(B a)
    {
    }
}

and it throws an ICE:

dmd: clone.c:35: FuncDeclaration*
AggregateDeclaration::hasIdentityOpAssign(Scope*, Dsymbol*): Assertion
`assign->ident == Id::assign' failed.

This is actually the closer to the original code that had the bug... shows me
right to try to reduce the code... I get a reduced fix!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9258



--- Comment #5 from Kenji Hara <k.hara.pg gmail.com> 2013-02-21 22:36:48 PST ---
(In reply to comment #4)
 Turns out this fix is incomplete. This code is still broken:
 
 class B
 {
 }
 
 class A : B
 {
     alias set opAssign;
 
     void set(B a)
     {
     }
 }
 
 and it throws an ICE:
 
 dmd: clone.c:35: FuncDeclaration*
 AggregateDeclaration::hasIdentityOpAssign(Scope*, Dsymbol*): Assertion
 `assign->ident == Id::assign' failed.
 
 This is actually the closer to the original code that had the bug... shows me
 right to try to reduce the code... I get a reduced fix!

https://github.com/D-Programming-Language/dmd/pull/1682 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 21 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9258



--- Comment #6 from github-bugzilla puremagic.com 2013-02-21 23:37:28 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/ad5b6fcf56d9861e44970889be161a5553226f7c
fix Issue 9258 - remove incorrect assertion

https://github.com/D-Programming-Language/dmd/commit/1cf47bec84ff7810fbe6e6008ba13f9e5e24d8d1
Merge pull request #1682 from 9rnsr/fix9258

fix Issue 9258 - remove incorrect assertion

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 21 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9258


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

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 24 2013