www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13337] New: Invalid extern C++ namespace resolution

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

          Issue ID: 13337
           Summary: Invalid extern C++ namespace resolution
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: chatelet.guillaume gmail.com

Consider this C++ code :

namespace A {
namespace B {

struct Type {};

int foo(Type unused){ return 42; }

}  // namespace B
}  // namespace A

Now this D code uses foo :

extern(C++, A.B) {
struct Type {}
int foo(Type unused);
}

void main() {
  foo(Type());
}

Compilation gives :
cpp_namespace.d:(.text._Dmain+0x11): undefined reference to
`A::B::foo(A::Type)'


Type is resolved in A and not in A.B
Specifying the full name doesn't help and gives the same result

extern(C++, A.B) {
struct Type {}
int foo(A.B.Type unused);
}

void main() {
  A.B.foo(A.B.Type());
}

--
Aug 19 2014