<p>I was testing a case of extension of lifetime of init list. The Test Case is as
follow :</p>
<p> </p>
<p><em><span class="com">#include</span><span class="pln"> </span><span class="str"><initializer_list></span></em><em><span class="pln">
<br></span><span class="kwd">extern</span><span class="pln"> </span><span class="str">"C"</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> abort</span><span class="pun">();</span></em><span class="pln"><br>
</span><em><span class="kwd">bool</span><span class="pln">
ok</span><span class="pun">;</span></em><em><span class="pln"> <br></span><span class="kwd">bool</span><span class="pln"> do_throw</span><span class="pun">;</span></em><em><span class="pln"> <br></span><span class="kwd">struct</span><span class="pln"> A </span><span class="pun">{</span></em><em><span class="pln"> <br>
A</span><span class="pun">(</span><span class="kwd">int</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></em><em><span class="pln"> <br>
</span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(</span><span class="pln">do_throw</span><span class="pun">)</span><span class="pln"> </span><span class="kwd">throw</span><span class="pln"> </span><span class="lit">42</span><span class="pun">;</span></em><em><span class="pln"> <br>
</span><span class="pun">}</span></em><em><span class="pln"> <br> </span><span class="pun">~</span><span class="pln">A</span><span class="pun">()</span><span class="pln"> </span><span class="pun">{</span></em><em><span class="pln"> <br>
</span><span class="kwd">if</span><span class="pln"> </span><span class="pun">(!</span><span class="pln">ok</span><span class="pun">)</span><span class="pln"> abort</span><span class="pun">();</span></em><em><span class="pln">
<br> </span><span class="pun">}</span></em><em><span class="pln"> <br>
</span><span class="pun">};</span></em><em><span class="pln"> <br><br></span><span class="kwd">typedef</span><span class="pln"> std</span><span class="pun">::</span><span class="pln">initializer_list</span><span class="pun"><</span><span class="pln">A</span><span class="pun">></span><span class="pln"> AL</span><span class="pun">;</span></em><span class="pln"><br>
<em></em></span><em><span class="kwd">typedef</span><span class="pln">
std</span><span class="pun">::</span><span class="pln">initializer_list</span><span class="pun"><</span><span class="pln">AL</span><span class="pun">></span><span class="pln"> AL2</span><span class="pun">;</span></em><em><span class="pln">
<br></span><span class="kwd">typedef</span><span class="pln"> std</span><span class="pun">::</span><span class="pln">initializer_list</span><span class="pun"><</span><span class="pln">AL2</span><span class="pun">></span><span class="pln"> AL3</span><span class="pun">;</span></em><em><span class="pln">
<br><br></span><span class="kwd">struct</span><span class="pln"> B </span><span class="pun">{</span></em><em><span class="pln"> <br> AL al</span><span class="pun">;</span></em><em><span class="pln"> <br> </span><span class="kwd">const</span><span class="pln"> AL</span><span class="pun">&</span><span class="pln"> alr</span><span class="pun">;</span></em><em><span class="pln"> <br>
</span><span class="pun">};</span></em><em><span class="pln"> <br><br></span><span class="kwd">int</span><span class="pln"> main</span><span class="pun">(</span><span class="kwd">int</span><span class="pln"> argc</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">const</span><span class="pln"> </span><span class="kwd">char</span><span class="pun">**</span><span class="pln"> argv</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span></em><span class="pln"><br>
<em> </em></span><em><span class="pln"> B b </span><span class="pun">=</span><span class="pln"> </span><span class="pun">{{</span><span class="lit">5</span><span class="pun">,</span><span class="lit">6</span><span class="pun">},{</span><span class="lit">7</span><span class="pun">,</span><span class="lit">8</span><span class="pun">}};</span></em><em><span class="pln"> <br>
</span><span class="pun">}</span><span class="pln"> </span></em></p>
<p> </p>
<p>Clang 3.3 throws error 'reference to type 'const AL' (aka 'const
initializer_list<A>') could not bind to an rvalue of type 'int' '. This is
because lifetime of init list was not extended. This issue is fixed in trunk
version and it does not throw any error. I was trying to backport the change in
3.3. I have identified 5 major revisions - r183283, r183594, r183859, r183872
and r185117. I applied the changes and the Test Case passes in the patched code.
However, when i run regression test on patched code, the test gets stuck at 99%
at unittest/Transforms/Utils/UtilsTests/IntegerDivision.Urem . Can someone
please point out and confirm the correct revision number. Also, why the
regression test is getting stuck and not completing?</p><br>-- <br>With regards,<br>Suyog Sarda<br>