<html>
    <head>
      <base href="https://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 recursion can get error reporting into an infinite loop"
   href="https://llvm.org/bugs/show_bug.cgi?id=26427">26427</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Template recursion can get error reporting into an infinite loop
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>r0maikx02b@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Error reporting can get into a very long (but probably not really infinite
loop).

The following snippet reproduces it nicely:

#include <memory>

template<class T>
void f(T t) {
   return f(std::make_unique<T>(t));
}

int main() {
    f(0);
}

I tried to compile it using: clang++ -std=c++14 main.cpp
The compiler starts spitting out long recursive template unique_ptr types.

Tested with r259432 but also happens in older versions as well.

Speculation:
If the make_unique call is replaced with an instantiation of a simpler template
class, then the built in recursion protection of clang kicks in, and it skips
the middle few hundred frames of the instantiation chain in the error message.
In any case you'll see that there is a very deeply nested type on the bottom of
the trace. My suspicion is that since unique_ptr has a more complicated
template interface, it simply takes much more characters to print a single
level of this nesting, and this causes the seemingly endless stream of errors.</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>