[LLVMbugs] [Bug 8789] New: Instantiating class template with friend declaration of C::f() hides in-line definition of C::f().
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Dec 14 06:04:47 PST 2010
http://llvm.org/bugs/show_bug.cgi?id=8789
Summary: Instantiating class template with friend declaration
of C::f() hides in-line definition of C::f().
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: hans at chromium.org
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
Compiling and linking the following code with Clang built from trunk r121764
fails:
template <typename T>
class ClassTemplate {
friend void T::func();
};
class C {
public:
void func() {
ClassTemplate<C> ct;
}
};
int main() {
C c;
c.func();
}
$ clang++ /tmp/c.cc
/usr/bin/ld: /tmp/cc-QB69fY.o: in function main:/tmp/c.cc(.text+0x14): error:
undefined reference to 'C::func()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If C::func() is defined out-of-line, it works.
It seems like instantiating ClassTemplate<> with its friend declaration of
T::func() somehow makes the in-line definition of C::func() disappear.
--
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