[LLVMbugs] [Bug 8492] New: clang does not respect 'visibility'='default' attribute for class members
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Oct 28 01:28:26 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=8492
Summary: clang does not respect 'visibility'='default'
attribute for class members
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: slyfox at inbox.ru
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
Created an attachment (id=5685)
--> (http://llvm.org/bugs/attachment.cgi?id=5685)
clang++-visibility-bug.tar.gz - the whole testcase
Let's consider the following shared c++ library:
//===--- foo.hh
struct C {
void hidden_foo(void);
// allowed to be used only in libfoo.so internally
void visible_bar(void) __attribute__ ((visibility("default")));
};
//===--- foo.cc
#include "foo.hh"
void C::hidden_foo(void)
{
}
void C::visible_bar(void)
{
hidden_foo();
}
I try to build in with one externally visible symbol: 'C::visible_bar' so set
default visibility.
Use case is a sample program:
//===--- main cc
#include "foo.hh"
int main()
{
C c;
c.visible_bar(); // should link
//c.hidden_foo(); // should fail to link
return 0;
}
$ clang++ -O2 -fPIC -fvisibility=hidden foo.cc -shared -o libfoo.so
$ clang++ -O2 -fPIC -fvisibility=hidden main.cc -L. -lfoo -o prog
/tmp/cc-xArWX9.o: In function `main':
main.cc:(.text+0xd): undefined reference to `C::visible_bar()'
collect2: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see
invocation)
g++ handles this fine.
I'll attach tarball with source files and script, which builds shared lib and a
program.
--
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