[LLVMbugs] [Bug 14619] New: Including stdlib.h in an extern "C" block causes a "declaration conflicts with target of using declaration already in scope"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Dec 16 22:43:02 PST 2012


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

             Bug #: 14619
           Summary: Including stdlib.h in an extern "C" block causes a
                    "declaration conflicts with target of using
                    declaration already in scope"
           Product: clang
           Version: 3.1
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Headers
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: basv at odd-e.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


When including <cstdlib> in an extern "C" block, it causes a compiler error.

I've had a compile error and eventually debugged it to this problem. When I
have a file that does this:

extern "C" {
 #include <cstdlib>
}

And I compile it, then it results into this error:

  abs(long __i) { return labs(__i); }
  ^
/usr/include/stdlib.h:146:6: note: target of using declaration
int      abs(int) __pure2;
         ^
/usr/include/c++/4.2.1/cstdlib:109:11: note: using declaration
  using ::abs;
          ^
/usr/include/c++/4.2.1/cstdlib:145:3: error: declaration conflicts with target
of using declaration already in scope
  div(long __i, long __j) { return ldiv(__i, __j); }
  ^
/usr/include/stdlib.h:158:8: note: target of using declaration
div_t    div(int, int) __pure2;
         ^
/usr/include/c++/4.2.1/cstdlib:116:11: note: using declaration
  using ::div;
          ^
2 errors generated.

This does work fine with other compilers... (gcc that is)


It does seem similar to this bug:

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

-- 
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