<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Broken symbol visibility on explicit template instantiation"
   href="http://llvm.org/bugs/show_bug.cgi?id=20521">20521</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Broken symbol visibility on explicit template instantiation
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>mail+llvm@tzik.jp
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12850" name="attach_12850" title="failcase">attachment 12850</a> <a href="attachment.cgi?id=12850&action=edit" title="failcase">[details]</a></span>
failcase

Clang fails to build a binary in attached case with error message below:
<span class="quote">>failcase_main.o:failcase_main.cc:function main: error: undefined reference to 'Failcase<Bar<int> >::~Failcase()'
>failcase_main.o:failcase_main.cc:function Failcase<Bar<int> >::Failcase(): error: undefined reference to 'vtable for Failcase<Bar<int> >'</span >

GCC successfully build the binary, and it emits ~Failcase() to libfailcase.so
as a WEAK DEFAULT symbol, while clang emits it as a LOCAL HIDDEN symbol
according to readelf -sW.

In addition, attached repro case is very fragile.
If I replace an "unsigned int" with "int", reorder the function definition or
removing no-op function call in the failcase.h,
it no longer reproduces the failure, and clang emits WEAK DEFAULT symbol to
libfailcase.so for ~Failcase().</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>