Bug 9694 – A member struct that has mutable opEquals reports weird error message

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-11T18:09:00Z
Last change time
2013-05-07T14:00:21Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2013-03-11T18:09:34Z
This code should work, but instead reports weird error. struct S { bool opEquals(ref S rhs) { assert(0); } } struct T { S s; } void main() { T t; assert(typeid(T).equals(&t, &t)); } output: test.d(9): Error: mutable method test.S.opEquals is not callable using a const object This is a regression introduced this commit: https://github.com/D-Programming-Language/dmd/commit/c63a0a1f864bdcf4cb2fcbee9428e9a35d821c43
Comment #1 by k.hara.pg — 2013-03-11T18:15:49Z
Comment #2 by github-bugzilla — 2013-03-11T19:22:31Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/02800ddf5c42102ebdef8273da28a96db43a3587 fix Issue 9694 - A member struct that has mutable opEquals reports weird error message https://github.com/D-Programming-Language/dmd/commit/c8c3ba1f3849d47912822077e8be1a04b46777a3 Merge pull request #1741 from 9rnsr/fix9694 [REG2.063a] Issue 9694 - A member struct that has mutable opEquals reports weird error message
Comment #3 by andrej.mitrovich — 2013-03-11T19:24:07Z
Should these types of git-head-only bugs be closed as fixed or worksforme?
Comment #4 by k.hara.pg — 2013-03-11T19:28:42Z
(In reply to comment #3) > Should these types of git-head-only bugs be closed as fixed or worksforme? If no actual test case is added in test suite, select WORKSFORME. Otherwise FIXED.
Comment #5 by andrej.mitrovich — 2013-03-11T19:29:40Z
(In reply to comment #4) > (In reply to comment #3) > > Should these types of git-head-only bugs be closed as fixed or worksforme? > > If no actual test case is added in test suite, select WORKSFORME. Otherwise > FIXED. Right, I was just thinking about the changelog. But we can remove this manually from the changelog now, so it's ok.
Comment #6 by github-bugzilla — 2013-05-07T14:00:21Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1ae37f347de33871568eaabda33c5ff964e79d12 Improve hasIdentityOpEquals and fix test result of issue 9694. TypeInfo.equals should throw an Error if the struct doesn't have const objects equality. For example when the struct has only mutable objects equality.