www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18928] New: extern(C++) bad codegen, wrong calling convention

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

          Issue ID: 18928
           Summary: extern(C++) bad codegen, wrong calling convention
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

Created attachment 1698
  --> https://issues.dlang.org/attachment.cgi?id=1698&action=edit
Test app

Crashing from bad codegen, uses wrong registers passing arguments.

Test calls a static function and a virtual function. Static function works as
expected, virtual call crashes.

Open the project in VS2015 (others may work) and build + run.
Place a breakpoint in the virtual `addUser`function and notice that it didn't
receive its argument correctly, and also fails to return its result correct.

Static version of the function calls properly.

--
May 31 2018