www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14092] New: C++ mangling for struct nested inside same class


          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 puremagic.com
          Reporter: coldencullen 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.

namespace v8
    class Isolate
        struct CreateParams { };
        static Isolate* New(CreateParams params) { return 0; }

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.

Jan 31 2015