[Issue 23788] New: Win64 problem with constructor for __c_complex_float

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 17 08:25:30 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23788

          Issue ID: 23788
           Summary: Win64 problem with constructor for __c_complex_float
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

---
import core.stdc.stdio;

enum __c_complex_float  : _Complex;
alias c_complex_float = __c_complex_float;

struct _Complex
{
    float re;
    float im;

    this(float re, float im) { this.re = re; this.im = im; }
}

c_complex_float toNative(float re, float im)
{
    printf("re: %g, im: %g\n", re, im);
    assert(re == 123 && im == 456);
    return c_complex_float(re, im);
}

void main()
{
    c_complex_float n = toNative(123, 456);
    printf("n.re: %g, n.im: %g\n", n.re, n.im);
    assert(123 == n.re); // fails here
    assert(456 == n.im);
}
------
If the constructor is removed, it works. The problem seems to lie in the
translation from the `enum __c_complex_float` to cfloat.

--


More information about the Digitalmars-d-bugs mailing list