<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 of deleted function template not possible"
   href="http://llvm.org/bugs/show_bug.cgi?id=17537">17537</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Explicit specialization of deleted function template not possible
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>jonathan.sauer@gmx.de
          </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>The following code fails to compile with clang r192096:

template <typename T>
void foo() = delete;

template <>
void foo<int>()
{
}

int main()
{
    foo<int>();
}


This results in:

% ~/LLVM/build/Release+Asserts/bin/clang++ -std=c++11 clang.cpp
clang.cpp:5:6: error: redefinition of 'foo'
void foo<int>()
     ^
clang.cpp:5:6: note: previous definition is here
clang.cpp:11:5: error: no matching function for call to 'foo'
    foo<int>();
    ^~~~~~~~
clang.cpp:2:6: note: candidate template ignored: substitution failure [with T =
int]
void foo() = delete;
     ^
2 errors generated.


According to ยง14.7.3p1 [temp.expl.spec], it should be allowed to delete a
function template while explicitly specializing it for a few types. This was
introduced by DR941:

| According to 14.7.3 [temp.expl.spec] paragraph 1, only non-deleted function
| templates may be explicitly specialized. There doesn't appear to be a
compelling
| need for this restriction, however, and it could be useful to forbid use of
| implicitly-instantiated specializations while still allowing use of
explicitly-
| specialized versions.

<<a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#941">http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#941</a>></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>