<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 --- - clang incorrectly rejects member function because of template substitution failure (out-of-line definition)"
   href="http://llvm.org/bugs/show_bug.cgi?id=15488">15488</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang incorrectly rejects member function because of template substitution failure (out-of-line definition)
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>martin.kronbichler@it.uu.se
          </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=10167" name="attach_10167" title="Reduced testcase.">attachment 10167</a> <a href="attachment.cgi?id=10167&action=edit" title="Reduced testcase.">[details]</a></span>
Reduced testcase.

In the attached reduced testcase, clang incorrectly gives me the compile error:

bug_clang_template_deduction.cpp:46:18: error: out-of-line definition of 'bar'
does not match any
      declaration in 'derived<a>'
void derived<a>::bar(Matrix<baseclass::n*baseclass::n>& F_x)

clang fails because of the combination of the following four aspects:
- the class "derived" and its base class "base" are templates
- the template parameter of the method is the result of a multiplication
- the factors are static const int's defined in the base class
- the operator * is overloaded for an unrelated data type (a simplified form of
std::complex) that can be implicitly constructed from int.

Removing any of these four aspects makes the code compile. The code is valid
afaict.

Tested on clang 3.2 and trunk:
clang version 3.3 (trunk 176804)
Target: x86_64-unknown-linux-gnu
Thread model: posix</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>