[Issue 14092] New: C++ mangling for struct nested inside same class as static function is broken when in namespace

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Jan 31 11:41:08 PST 2015


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

          Issue ID: 14092
           Summary: C++ mangling for struct nested inside same class as
                    static function is broken when in namespace
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: coldencullen at gmail.com

On OSX (possibly other platforms, I haven't gotten to check), when a class in a
namespace has a static extern(C++) function takes a struct nested inside the
same class, the mangling for that struct ignores it's parent class, and just
uses the namespace qualifier.

Example:
C++:
---
namespace v8
{
    class Isolate
    {
    public:
        struct CreateParams { };
        static Isolate* New(CreateParams params) { return 0; }
    };
}
---

D:
---
extern(C++, v8)
{
    class Isolate
    {
        struct CreateParams { }
        static Isolate New(CreateParams params);
    }
}

void main()
{
    auto o1 = Isolate.New( Isolate.CreateParams() );
}
---

This results in the following error message:
---
Undefined symbols for architecture x86_64:
  "v8::Isolate::New(v8::CreateParams)", referenced from:
      __Dmain in run_test.o
ld: symbol(s) not found for architecture x86_64
---

It should be looking for "v8::Isolate::New(v8::Isolate::CreateParams)" instead.

--


More information about the Digitalmars-d-bugs mailing list