[LLVMbugs] [Bug 8952] New: extern "C" function returning pointer to class in namespace{} silently drops symbol

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jan 10 14:30:49 PST 2011


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

           Summary: extern "C" function returning pointer to class in
                    namespace{} silently drops symbol
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ps at kr.tuwien.ac.at
                CC: llvmbugs at cs.uiuc.edu


I compiled the following minimal example with clang trunk using "clang++ -c"

===
namespace{
class Foo {};
Foo f;
}
extern "C" Foo* bar() { return &f; }
extern "C" void* baz() { return reinterpret_cast<void*>(&f); }
===

The resulting object file has no symbol "bar" but it has a symbol "baz".
There is no warning and no error.
g++ 4.4.5 creates an object file with both symbols (and they are usable).

I honestly do not know which compiler is right, but probably if the symbol is
not generated there should at least be a warning.

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