<div dir="ltr">This is <a href="https://bugs.llvm.org/show_bug.cgi?id=33561">https://bugs.llvm.org/show_bug.cgi?id=33561</a></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 15, 2018 at 5:11 AM, Han Wang via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi all, <div><br></div><div>The simple code listed below will make clang hang with compiler option -fdelayed-template-<wbr>parsing. <br><div><br></div><div>
<div style="color:rgb(0,0,0);background-color:rgb(255,255,254);font-family:monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(0,0,255)">#include</span><span style="color:rgb(0,0,0)"> <vector></span></div><br><div><span style="color:rgb(0,0,255)">template</span><span style="color:rgb(0,0,0)"> <</span><span style="color:rgb(0,0,255)">typename</span><span style="color:rgb(0,0,0)"> Func, </span><span style="color:rgb(0,0,255)">typename</span><span style="color:rgb(0,0,0)"> Args></span></div><div><span style="color:rgb(0,0,255)">auto</span><span style="color:rgb(0,0,0)"> test_func_wrapper(Func </span><span style="color:rgb(0,0,255)">const</span><span style="color:rgb(0,0,0)">& func, Args </span><span style="color:rgb(0,0,255)">const</span><span style="color:rgb(0,0,0)">& args) {</span></div><div><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,255)">return</span><span style="color:rgb(0,0,0)"> func(args);</span></div><div><span style="color:rgb(0,0,0)">}</span></div><br><div><span style="color:rgb(0,0,255)">void</span><span style="color:rgb(0,0,0)"> clang_bug_test() {</span></div><div><span style="color:rgb(0,0,0)"> std::vector<</span><span style="color:rgb(0,0,255)">int</span><span style="color:rgb(0,0,0)">> vecn{</span><span style="color:rgb(9,136,90)">1</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(9,136,90)">2</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(9,136,90)">3</span><span style="color:rgb(0,0,0)">};</span></div><div><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,255)">auto</span><span style="color:rgb(0,0,0)"> f = [](</span><span style="color:rgb(0,0,255)">auto</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,255)">const</span><span style="color:rgb(0,0,0)">& vecn) -> </span><span style="color:rgb(0,0,255)">int</span><span style="color:rgb(0,0,0)"> {</span></div><div><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,255)">return</span><span style="color:rgb(0,0,0)"> vecn[</span><span style="color:rgb(9,136,90)">0</span><span style="color:rgb(0,0,0)">];</span></div><div><span style="color:rgb(0,0,0)"> };</span></div><div><span style="color:rgb(0,0,0)"> test_func_wrapper(f, vecn);</span></div><div><span style="color:rgb(0,0,0)">}</span></div><br><div><span style="color:rgb(0,0,255)">int</span><span style="color:rgb(0,0,0)"> main() {</span></div><div><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(0,0,255)">return</span><span style="color:rgb(0,0,0)"> </span><span style="color:rgb(9,136,90)">0</span><span style="color:rgb(0,0,0)">;</span></div><div><span style="color:rgb(0,0,0)">}</span></div></div>
<br></div><div>It happens on my mac (Apple LLVM version 9.0.0 (clang-900.0.38)) and also on <a href="http://godbolt.org" target="_blank">godbolt.org</a> and <a href="http://wandbox.org" target="_blank">wandbox.org</a> with all clang versions. </div><div><br></div><div>If we remove the trailing return type of the generic lambda, it compiles. </div><div>If we don't use vecn at all in the lambda and simply return 0, it also compiles. </div><div>If we remove the -fdelayed-template-<wbr>parsing, it compiles.</div><div><br></div><div>Best regards,</div><div>Han</div></div></div>
<br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>