<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - CTAD fails to find some defaulted template parameters after first declaration of template"
   href="https://bugs.llvm.org/show_bug.cgi?id=41549">41549</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>CTAD fails to find some defaulted template parameters after first declaration of template
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>arthur.j.odwyer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Reduced from a test case involving class template argument deduction on libc++
unordered_multimap.

// <a href="https://godbolt.org/z/X3OqH0">https://godbolt.org/z/X3OqH0</a>
#if FAIL
template <class H, class P> struct umm;
#endif

template <class H = int, class P = int>
struct umm {
    explicit umm(H h = 0, P p = 0);
};

void t() {
    umm m(1);
}

====

$ clang++ -std=c++17 test.cc
(OK)

$ clang++ -std=c++17 test.cc -DFAIL
<source>:11:9: error: no viable constructor or deduction guide for deduction of
template arguments of 'umm'
    umm m(1);
        ^
<source>:7:14: note: candidate template ignored: couldn't infer template
argument 'P'
    explicit umm(H h = 0, P p = 0);
             ^
<source>:2:36: note: candidate template ignored: could not match 'umm<H, P>'
against 'int'
template <class H, class P> struct umm;
                                   ^
1 error generated.

====

GCC, ICC, and MSVC all agree that this code should be considered well-formed:
CTAD should happily take the defaulted value of `P` from the visible
declaration of the primary template, even though that declaration is not the
first declaration in the source file.</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>