<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 --- - template argument deduction preformed on non-matching overloads."
   href="http://llvm.org/bugs/show_bug.cgi?id=20261">20261</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>template argument deduction preformed on non-matching overloads.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>eric@efcs.ca
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>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=12758" name="attach_12758" title="Reproducer">attachment 12758</a> <a href="attachment.cgi?id=12758&action=edit" title="Reproducer">[details]</a></span>
Reproducer

The following code does not compile with clang. It seems that even though the
second overload does not match the arguments template argument deduction is
performed on it causing bad_type to be instantiated.

I don't believe that is correct behavior.

This bug is currently playing havoc with std::tuples allocator_arg_t overloads.

<span class="quote">> template <class T>
> struct never { enum { value = 0 }; };</span >
>
<span class="quote">> template <class T>
> struct bad_type
> {
>    static_assert(never<T>::value, "Should not be instantiated");
>    typedef bad_type type;
> };</span >
>
<span class="quote">> struct dummy_type {};</span >
>
<span class="quote">> struct test_t
> {
>    // Overload #1
>    test_t(int, int) {}
>    
>    // Overload #2
>    template <class First, class = typename bad_type<First>::type>
>    test_t(dummy_type, First) {}
> };</span >
>
<span class="quote">> int main() { test_t t(0, 0); }</span ></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>