https://llvm.org/bugs/show_bug.cgi?id=26427

            Bug ID: 26427
           Summary: Template recursion can get error reporting into an
                    infinite loop
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to