Title: Samsung Enterprise Portal mySingle

Hi,

Attached is the fix for Compiler crash caused by infinite loop when we try to compile the following code.

 

struct A;

struct B
{
  B (A const &); 

  B (B &); 
};

struct A
{
  A (B);
};

B
f (B const& b)
{
  return b; 

}

 

This causes an endless recursion. Here the copy constructor can't be used,
so a conversion through A(B) constructor and then B(A const &)is attempted.
But that needs a temporary, so a B(const B &) copy constructor is needed,
which is not there and hence we are back to the original problem.
If A's constructor is instead A (const B &) {}, then it compiles just fine.
In the fix we detect recursion by remembering one parent type, so we will try
only one hop through some other class' constructor. We store the parent in a map
called ccInitMap and keep a track of it. When we see that the same parent has more
than one entry in the map, we break out and give an error.

Thanks,
Mayur


 

 

 

Attachment: ice_infinite_recursion.patch
Description: Binary data

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to