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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to