[LLVMbugs] [Bug 9384] New: Incorrect "ambiguous function" error for extern "C" functions declared and defined in different namespaces

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 2 16:36:42 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9384

           Summary: Incorrect "ambiguous function" error for extern "C"
                    functions declared and defined in different namespaces
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


[dcl.link]p6 says, "Two declarations for a function with C language linkage
with the same function name (ignoring the namespace names that qualify it) that
appear in different namespace scopes refer to the same function"

So I think the call in bar() shouldn't be ambiguous below:


$ cat test.cc
namespace gold
{
extern "C" void
foo();
}

using namespace gold;

extern "C" void
foo()
{}

extern "C" void
bar()
{
  foo();
}

$ clang++  -Wall -Werror -c test.cc
test.cc:16:3: error: call to 'foo' is ambiguous
  foo();
  ^~~
test.cc:4:1: note: candidate function
foo();
^
test.cc:10:1: note: candidate function
foo()
^
1 error generated.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list