Fix for ICE in clang due to infinite loop.

Eli Friedman eli.friedman at
Mon Sep 9 14:53:20 PDT 2013

On Mon, Sep 9, 2013 at 5:08 AM, MAYUR PANDEY <mayur.p at> wrote:

>  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;
> }
The patch is missing a testcase.  Patches should generally include a
corresponding change to clang/test/.  (In this case, somewhere in
clang/test/SemaCXX/ is probably appropriate.)

This is not the right approach to fixing this issue.  One, we're supposed
to detect issues like this inside the InitializationSequence constructor,
when we actually check the initialization.  Not handling this correctly
will break overload resolution.  Second, using a global map like this is
rather suspect: I'm not sure it will cause issues, but introducing global
state for something like this makes it more difficult to understand the

My guess is that the right fix is somewhere in SemaOverload.cpp: we're
probably mishandling this case in the user-defined conversion code

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the cfe-commits mailing list