<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 --- - "extern template" seems to invoke explicit instanciation but it should prohibit it."
   href="http://llvm.org/bugs/show_bug.cgi?id=20825">20825</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>"extern template" seems to invoke explicit instanciation but it should prohibit it.
          </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++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>gw.fossdev@gmail.com
          </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=12967" name="attach_12967" title="A simple test case to illustrate the problem.">attachment 12967</a> <a href="attachment.cgi?id=12967&action=edit" title="A simple test case to illustrate the problem.">[details]</a></span>
A simple test case to illustrate the problem.

If I understood N1448 of the C++11 standard correctly, then "extern template"
should inhibit (implicite) instansiation. However, diagnostics now tell me that
explicit instantiation is actually invoked, inhibiting to partially specialize
static member variables. 

The test case given below issues the following disgnostics with 

Debian clang version 3.5.0-+rc1-2 (tags/RELEASE_35/rc1) (based on LLVM 3.5.0)

==============

testcase.cc:12:34: error: explicit specialization of 'info' after instantiation
template <> const char * A<int>::info = "This is int"; 
                                 ^
testcase.cc:9:23: note: explicit instantiation first required here
extern template class A<int>; 
                      ^
testcase.cc:13:35: error: explicit specialization of 'info' after instantiation
template <> const char * A<char>::info = "This is char"; 
                                  ^
testcase.cc:10:23: note: explicit instantiation first required here
extern template class A<char>; 
                      ^
2 errors generated.
=============

g++ (4.9) compiles and links this code fine. 

In the code that made me aware of the problem the "extern template" is of
course located in a header file, and hence the specialization can not be added
before the "extern template" because it results in multiple definitions at link
time. On the other hand, using "extern template" is required to enforce
visibility attributes. 

Many thanks.</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>