[cfe-commits] r101717 - /cfe/trunk/lib/Sema/SemaOverload.cpp

Douglas Gregor dgregor at apple.com
Sun Apr 18 10:20:10 PDT 2010


On Apr 18, 2010, at 5:05 AM, Benjamin Kramer wrote:

> Author: d0k
> Date: Sun Apr 18 07:05:54 2010
> New Revision: 101717
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=101717&view=rev
> Log:
> Bail out early to avoid comparing the internals of two conversion sequences of
> different kinds (aka garbage). This happens if we're comparing a standard
> conversion sequence to an ambiguous one which have the same KindRank.
> 
> Found by valgrind.

Good catch, thanks!

	- Doug

> Modified:
>    cfe/trunk/lib/Sema/SemaOverload.cpp
> 
> Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=101717&r1=101716&r2=101717&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaOverload.cpp Sun Apr 18 07:05:54 2010
> @@ -1763,6 +1763,11 @@
>   else if (ICS2.getKindRank() < ICS1.getKindRank())
>     return ImplicitConversionSequence::Worse;
> 
> +  // The following checks require both conversion sequences to be of
> +  // the same kind.
> +  if (ICS1.getKind() != ICS2.getKind())
> +    return ImplicitConversionSequence::Indistinguishable;
> +
>   // Two implicit conversion sequences of the same form are
>   // indistinguishable conversion sequences unless one of the
>   // following rules apply: (C++ 13.3.3.2p3):
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list