Bug 23778 – Code generator fails to handle __c_complex_real properly for Windows

Status
RESOLVED
Resolution
FIXED
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2023-03-14T08:26:32Z
Last change time
2023-04-01T22:15:11Z
Keywords
backend, pull
Assigned to
No Owner
Creator
Walter Bright

Comments

Comment #0 by bugzilla — 2023-03-14T08:26:32Z
Test code: ---- enum __c_long_double : double; alias __c_long_double c_long_double; struct _Complex { c_long_double re; c_long_double im; } version (all) { // fails enum __c_complex_real : _Complex; alias c_complex_real = __c_complex_real; } else // works enum c_complex_real : _Complex; c_complex_real toNative2(real re, real im) { return c_complex_real(re, im); } void main() { c_complex_real n = toNative2(123, 456); assert(123 == n.re && 456 == n.im); } --------- The trouble is that __c_complex_real is treated specially in the compiler, and in totym() it is always replaced with TYcldouble. On Windows where long doubles are actually doubles, it should be TYldouble.
Comment #1 by bugzilla — 2023-03-14T08:27:14Z
Comment #2 by dlang-bot — 2023-03-14T21:31:34Z
@WalterBright created dlang/dmd pull request #14987 "fix Issue 23778 - Code generator fails to handle __c_complex_real pro…" fixing this issue: - fix Issue 23778 - Code generator fails to handle __c_complex_real properly for Windows https://github.com/dlang/dmd/pull/14987
Comment #3 by dlang-bot — 2023-03-16T18:35:18Z
dlang/dmd pull request #14987 "fix Issue 23778 - Code generator fails to handle __c_complex_real pro…" was merged into stable: - a038901b00c82d890aa246c95d9e6bb43b7f74a1 by Walter Bright: fix Issue 23778 - Code generator fails to handle __c_complex_real properly for Windows https://github.com/dlang/dmd/pull/14987
Comment #4 by dlang-bot — 2023-04-01T22:15:11Z
dlang/dmd pull request #15066 "merge stable" was merged into master: - 5320bf29458245e4527c34aecde325b4e839a8a9 by Walter Bright: fix Issue 23778 - Code generator fails to handle __c_complex_real properly for Windows https://github.com/dlang/dmd/pull/15066