[LLVMbugs] [Bug 7927] New: clang++: extern"C" in namespace cannot be compiled

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Aug 17 06:01:52 PDT 2010


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

           Summary: clang++: extern"C" in namespace cannot be compiled
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: geek4civic at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


enum T {E};

extern "C" void f(int);

namespace {
  extern "C" void f(int);

  void foo()
  {
    f(E);    // err
    f(0);
    ::f(E);
    ::f(0);
  }
}

void bar()
{
  f(E);    // err
  f(0);    // err
  ::f(E);
  ::f(0);
}
////////////////////////////////

* checked on mingw and ppc-f12.
* It passes on g++-4.4.0.
* It will pass on clang++ when either of extern is commented out.

I met this issue when I attempted buiding stage2 clang on mingw.
at lib/System/Win32/Program.inc:321 SetInformationJobObject().

////////////////////////////////

$ ../Release+Asserts/bin/clang++.exe p.cc -S
p.cc:10:5: error: call to 'f' is ambiguous
    f(E);    // err
    ^
p.cc:3:17: note: candidate function
extern "C" void f(int);
                ^
p.cc:6:19: note: candidate function
  extern "C" void f(int);
                  ^
p.cc:19:3: error: call to 'f' is ambiguous
  f(E);    // err
  ^
p.cc:3:17: note: candidate function
extern "C" void f(int);
                ^
p.cc:6:19: note: candidate function
  extern "C" void f(int);
                  ^
p.cc:20:3: error: call to 'f' is ambiguous
  f(0);    // err
  ^
p.cc:3:17: note: candidate function
extern "C" void f(int);
                ^
p.cc:6:19: note: candidate function
  extern "C" void f(int);
                  ^
3 errors 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