diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-04-18 12:05:54 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-04-18 12:05:54 +0000 |
| commit | 98ff7f873089b267a22366a36690d924559db84d (patch) | |
| tree | 1b8a2464715aba84d747b405d98fff42b5493361 /clang/lib | |
| parent | 870f3743e48838827244763ef1c3e9ecdd1fbb0c (diff) | |
| download | bcm5719-llvm-98ff7f873089b267a22366a36690d924559db84d.tar.gz bcm5719-llvm-98ff7f873089b267a22366a36690d924559db84d.zip | |
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.
llvm-svn: 101717
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 6772672bef1..7a37daaa742 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1763,6 +1763,11 @@ Sema::CompareImplicitConversionSequences(const ImplicitConversionSequence& ICS1, 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): |

