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

Benjamin Kramer benny.kra at googlemail.com
Sun Apr 18 05:05:54 PDT 2010

Author: d0k
Date: Sun Apr 18 07:05:54 2010
New Revision: 101717

URL: http://llvm.org/viewvc/llvm-project?rev=101717&view=rev
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.


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++

More information about the cfe-commits mailing list