[LLVMdev] extern "C" and namespaces
Riyaz Puthiyapurayil
Riyaz.Puthiyapurayil at synopsys.com
Thu Sep 19 16:50:52 PDT 2013
Can someone confirm whether the following is a known clang bug? I am having a lot of trouble compiling some old legacy code due to this error. I know "using namespace" is horrible but that doesn't make it illegal (g++ accepts this). The fix is easy but there are just too many instances of this in the legacy code. The following is not from the code I am trying to compile but is derived from an example in the C++11 standard (7.3.4 note 6)
foo.cpp:
namespace A {
extern "C" int g();
extern "C++" int h();
}
namespace B {
extern "C" int g();
extern "C++" int h(int);
}
using namespace A;
using namespace B;
void f() {
g(); // okay: name g refers to the same entity
h(); // okay: overload resolution selects A::h
}
foo.cpp:12:5: error: call to 'g' is ambiguous
g(); // okay: name g refers to the same entity
^
foo.cpp:2:20: note: candidate function
extern "C" int g();
^
foo.cpp:6:20: note: candidate function
extern "C" int g();
^
1 error generated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130919/c7a17be3/attachment.html>
More information about the llvm-dev
mailing list