[llvm-bugs] [Bug 26498] New: Extern template function not emitted available_externally while class methods are

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 5 11:22:43 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26498

            Bug ID: 26498
           Summary: Extern template function not emitted
                    available_externally while class methods are
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: mehdi.amini at apple.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Considering this code:

template <class F> F foo() { return 1; }
template <class F> struct S { F foo() { return 1; } };
extern template int foo<int>();
extern template struct S<int>;
int bar() { return foo<int>() + S<int>().foo(); }


Compiled with: clang++ -O2 -mllvm -disable-llvm-optzns -S -emit-llvm -o -  |
grep foo

We can see:

  %2 = call i32 @_Z3fooIiET_v()
  %3 = call i32 @_ZN1SIiE3fooEv(%struct.S* %1)
declare i32 @_Z3fooIiET_v() #1
define available_externally i32 @_ZN1SIiE3fooEv(%struct.S* %this) #2 align 2 {


I'm not sure why the extern template class method is emitted
available_externally while the free function is not.

-- 
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/20160205/61ec273d/attachment.html>


More information about the llvm-bugs mailing list