Bug 18746 – function returning empty struct isn't called if used in equality expression

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-04-08T19:53:16Z
Last change time
2018-04-17T10:17:58Z
Keywords
wrong-code
Assigned to
RazvanN
Creator
ag0aep6g

Comments

Comment #0 by ag0aep6g — 2018-04-08T19:53:16Z
Code is very similar to issue 12486, but apparently it's a different bug. ---- struct S {} S f(ref int i) { ++i; return S(); } void main() { int i = 2; assert(f(i) == S()); assert(i == 3); /* fails, i = 2; should pass */ } ----
Comment #1 by razvan.nitu1305 — 2018-04-09T15:45:32Z
Comment #2 by github-bugzilla — 2018-04-17T10:17:57Z
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/db1f8041670d592c3ad94111a3dc83ba12237932 Fix Issue 18746 - function returning empty struct isn't called if used in equality expression https://github.com/dlang/dmd/commit/ebd69c0b9ff4ae64d8e2a4aeef2939c973e6ad5b Merge pull request #8153 from RazvanN7/Issue_18746 Fix Issue 18746 - function returning empty struct isn't called if used in equality expression merged-on-behalf-of: Razvan Nitu <[email protected]>