<div dir="ltr"><div dir="ltr"><div>Hi,</div><div>thanks for clarifying this. I tried to compile the above testcase on a faster system and it produced much less error output. So I guess I was just out of luck with my original code (it was more complex than the testcase I tried to create, with several levels of recursion), because it filled up my 250GB ssd and made my linux box unusable (I had errors redirected to a file). I guess that when clang hangs if "printf" line is removed is related to the same issue.<br></div><div>Anyway, if trunk is already giving less error output then I guess is fine, but probably lowering the nested template limit in case of error or warning would be helpful in similar cases. Especially if you're using an IDE that does parsing/autocompletion with clang. If I try that code on clion for example, it just hangs and makes it unusable. But of course this is not a clang issue.</div><div>Thanks anyway!</div><div><br></div><div>Best regards,</div><div><br></div><div>Lorenzo<br></div><div><br></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 29, 2019 at 4:13 PM Arthur O'Dwyer <<a href="mailto:arthur.j.odwyer@gmail.com" target="_blank">arthur.j.odwyer@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br><div class="gmail_quote"><div><br></div><div>The Clang issue is not related to CTAD.  You can achieve the same "infinite" error message via explicitly (wrongly) supplied template arguments, too. Just replace</div><div><br></div><div><span style="font-family:monospace,monospace;font-size:x-small">    printV(std::vector{v.begin(), v.end()+middle});</span><br></div><div>with</div><div><span style="font-family:monospace,monospace;font-size:x-small"><br></span></div><div><span style="font-family:monospace,monospace;font-size:x-small">    using VI = std::vector<typename std::vector<T>::const_iterator>;</span></div><div><span style="font-family:monospace,monospace;font-size:x-small">    printV(VI{v.begin(), v.end()+middle});</span><br></div><div><br></div><div>By the way, CTAD is behaving as intended here: you gave an initializer-list of const_iterators, and so you get a vector of const_iterators. If you didn't want a vector of const_iterators, you should have used the sequence-container-constructor syntax (round parens), not the braced-initializer-list syntax (braces).</div><div>See also <a href="https://quuxplusone.github.io/blog/2018/12/09/wctad/" target="_blank">"<i>Contra</i> CTAD"</a> and <a href="https://quuxplusone.github.io/blog/2019/02/18/knightmare-of-initialization/" target="_blank">"The Knightmare of Initialization in C++"</a>.</div><div><br></div><div>Here's an ultra-reduced test case.</div><div><br></div><div><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">[[nodiscard]] int dummy();</span></p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;min-height:15px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">template<class T></span></p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">void printV(T t) {</span></p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">    dummy();</span></p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">    printV(&t);</span></p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">}</span></p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo;min-height:15px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">int main() {</span></p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">    printV(42);</span></p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo">









</p><p style="margin:0px;font-stretch:normal;font-size:13px;line-height:normal;font-family:Menlo"><span style="font-variant-ligatures:no-common-ligatures">}</span></p></div><div><br></div><div>The same O(1024^2) lines of error output are produced, but much faster, because Clang doesn't have to instantiate all those nested template types (or render their names in the error messages).</div><div><br></div><div>I think it might be convenient if Clang lowered the nested template limit from 1024 to, say, 32, in the case that a warning or error message has been produced already.</div><div><br></div><div>–Arthur</div></div></div></div></div></div></div></div></div>
</blockquote></div>
</div>