Specifying C++ symbols in C++ namespaces

Michel Fortin michel.fortin at michelf.ca
Sat Apr 5 18:26:00 PDT 2014


On 2014-04-05 20:47:32 +0000, Walter Bright <newshound2 at digitalmars.com> said:

> Yes, this seems to be a fatal flaw. Another design that has evolved 
> from these discussions and my discussions with Andrei on it:
> 
>      extern (C++, namespace = A.B) { void foo(); void bar(); }
>      extern (C++, namespace = C) void foo();
> 
>      bar();  // works
>      A.B.bar(); // works
>      foo(); // error: ambiguous
>      C.foo();   // works
> 
>      alias C.foo foo;
>      foo();  // works, calling C.foo()

What if you also have a C++ foo at global scope?

	module cpptest;

	extern (C++) void foo();
	extern (C++, namespace = A) void foo();

	foo(); // ambiguous
	A.foo(); // works
	.foo(); // works?
	cpptest.foo(); // works?

Does these two last lines make sense?


-- 
Michel Fortin
michel.fortin at michelf.ca
http://michelf.ca



More information about the Digitalmars-d mailing list