[Issue 24074] New: Reference to struct not working, when executed as a task

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 6 13:04:47 UTC 2023


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

          Issue ID: 24074
           Summary: Reference to struct not working, when executed as a
                    task
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody at puremagic.com
          Reporter: js.wohlleben at gmail.com

Created attachment 1883
  --> https://issues.dlang.org/attachment.cgi?id=1883&action=edit
This file contains the pi benchmark implementation using references

I tried to execute a function, that takes a struct reference, as a task. This
doesnt work. If I use a pointer instead, the code runs just fine. The
"pi_ref.d" example uses the "ref"-keyword and doesnt work. The code calculates
pi with different threads. Execute for example with ./pi 2000000000 4 to
monitor behaviour.

Expected output: 3.14159
Actual output: nan, because it is passed as a value, not as a reference

--


More information about the Digitalmars-d-bugs mailing list