<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 --- - explicit specialization declarations don't work if they appear after the template-id is mentioned"
   href="http://llvm.org/bugs/show_bug.cgi?id=22670">22670</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>explicit specialization declarations don't work if they appear after the template-id is mentioned
          </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>richard-llvm@metafoo.co.uk
          </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>Consider:

template<int> struct A {};
typedef A<1> A1;
template<> struct A<1>;                                         
void f() { delete (A1*)0; }
template<> struct A<1> {};

Clang rejects this saying:

<stdin>:5:19: error: redefinition of 'A<1>'
template<> struct A<1> {};
                  ^~~~
<stdin>:1:22: note: previous definition is here
template<int> struct A {};
                     ^

But that's wrong: we should not have instantiated A<1> from the primary
template because we have a declaration of an explicit specialization for A<1>.
Instead, we should have treated the delete-expression as deleting an incomplete
type.

Creating the template-id A<1> should not cause the implicit instantiation of
A<1>, so we are not required to first declare the explicit specialization. And
even if we were incorrectly doing so, we should instead diagnose this as:

<stdin>:3:19: error: explicit specialization of 'A<1>' after instantiation
template<> struct A<1>;
                  ^~~~
<stdin>:2:9: note: implicit instantiation first required here
typedef A<1> A1;
        ^</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>