[LLVMbugs] [Bug 15930] New: wrong linkage for function template instantiated with type with internal or no linkage
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue May 7 18:32:30 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=15930
Bug ID: 15930
Summary: wrong linkage for function template instantiated with
type with internal or no linkage
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: richard-llvm at metafoo.co.uk
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
When a function template is instantiated with a type that has internal or no
linkage, we incorrectly give that function internal linkage. For instance:
template<typename T> void *f(T) { static int n; return &n; }
inline void *g() { struct S {} s; return f(s); }
Suppose this code appears in two translation units. The 'struct S' inside 'g'
is required to be treated as the same type in both translation units, even
though it has no linkage (by [basic.def.odr]p6, we are required to act as if
there were only one definition of 'g' in the program). So the two
instantiations of f<S> must produce the same function, and must share a static
local 'n'.
Clang incorrectly emits f<S> and f<S>::n as internal symbols for this code.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130508/88ccaa10/attachment.html>
More information about the llvm-bugs
mailing list