<HTML><HEAD><TITLE>Samsung Enterprise Portal mySingle</TITLE>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type>
<STYLE id=mysingle_style type=text/css>P {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
TD {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
LI {
        MARGIN-TOP: 5px; FONT-FAMILY: Arial, arial; MARGIN-BOTTOM: 5px; FONT-SIZE: 9pt
}
BODY {
        LINE-HEIGHT: 1.4; MARGIN: 10px; FONT-FAMILY: Arial, arial; FONT-SIZE: 9pt
}
</STYLE>

<META name=GENERATOR content=ActiveSquare></HEAD>
<BODY>
<P><SPAN style="FONT-FAMILY: Arial">Hi,</SPAN></P>
<P><SPAN style="FONT-FAMILY: Arial">Attached is the fix for Compiler crash caused by infinite loop when we try to compile the following code.</SPAN></P>
<P><SPAN style="FONT-FAMILY: Arial"></SPAN> </P>
<P><SPAN style="FONT-FAMILY: Arial">struct A;</SPAN></P>
<P><SPAN style="FONT-FAMILY: Arial">struct B<BR>{<BR>  B (A const &); </SPAN></P>
<P><SPAN style="FONT-FAMILY: Arial">  B (B &); <BR>};</SPAN></P>
<P><SPAN style="FONT-FAMILY: Arial">struct A<BR>{<BR>  A (B);<BR>};</SPAN></P>
<P><SPAN style="FONT-FAMILY: Arial">B<BR>f (B const& b)<BR>{<BR>  return b; </SPAN></P>
<P><SPAN style="FONT-FAMILY: Arial">}</SPAN></P>
<P><SPAN style="FONT-FAMILY: Arial"></SPAN> </P><PRE class=bz_comment_text><SPAN style="FONT-FAMILY: Arial">This causes an endless recursion. Here the copy constructor can't be used,<BR>so a conversion through A(B) constructor and then B(A const &)is attempted.<BR>But that needs a temporary, so a B(const B &) copy constructor is needed,<BR>which is not there and hence we are back to the original problem.</SPAN></PRE><PRE class=bz_comment_text><SPAN style="FONT-FAMILY: Arial">If A's constructor is instead A (const B &) {}, then it compiles just fine.<BR>In the fix we detect recursion by remembering one parent type, so we will try<BR>only one hop through some other class' constructor. We store the parent in a map<BR>called ccInitMap and keep a track of it. When we see that the same parent has more<BR>than one entry in the map, we break out and give an error.</SPAN></PRE>
<P><SPAN style="FONT-FAMILY: Arial">Thanks,<BR>Mayur</SPAN></P>
<P><BR> </P>
<P> </P><!--SP:mayur.p--><!--mayur.p:EP-->
<P> </P>
<TABLE id=confidentialsignimg>
<TBODY>
<TR>
<TD NAMO_LOCK>
<P><IMG border=0 src="cid:BEI0XT4NZ5JE@namo.co.kr" width=520></P></TD></TR></TBODY></TABLE></BODY></HTML><img src='http://ext.samsung.net/mailcheck/SeenTimeChecker?do=07afe5b83c3fd7b80bfb8bd002bfb5aeaa8bda2d498f47c8e9a2b094e88a4f1f81a5d6148418374b434c6ebf74e200ff220d3e02ce1cb961d6250c6ef56fc7aacf878f9a26ce15a0' border=0 width=0 height=0 style='display:none'>