Bug 9258 – opAssign with base class triggers "identity assignment operator overload" error

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-02T11:16:00Z
Last change time
2013-02-24T01:28:44Z
Keywords
ice, pull, rejects-valid
Assigned to
nobody
Creator
siegelords_abode

Comments

Comment #0 by siegelords_abode — 2013-01-02T11:16:22Z
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.
Comment #1 by andrej.mitrovich — 2013-01-12T19:26:55Z
Introduced by: commit 9ee798f73a2f7765a68bbe8f40ff292f551dab72 Author: k-hara <[email protected]> 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.
Comment #2 by k.hara.pg — 2013-01-30T20:18:40Z
Comment #3 by github-bugzilla — 2013-01-31T01:47:37Z
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
Comment #4 by siegelords_abode — 2013-02-21T20:10:52Z
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!
Comment #5 by k.hara.pg — 2013-02-21T22:36:48Z
(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
Comment #6 by github-bugzilla — 2013-02-21T23:37:28Z
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