[LLVMbugs] [Bug 9518] New: Friend function definition not instantiated in certain circumstances
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Mar 20 17:04:08 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9518
Summary: Friend function definition not instantiated in certain
circumstances
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: schaub.johannes at googlemail.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
The following fails to link, not finding the definition of "f".
template<typename T>
struct provide {
friend T f() { return T(); }
};
void g() {
void f();
provide<void> p;
f();
}
int main() {
g();
}
Swapping the order of "void f();" and the definition of "p", or moving "void
f();" to namespace scope, makes it link correctly.
--
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