Fix template type matching algorithm in the presence of wildcards.
commit3b7fc272c199a66b9d2bbecad18a3997c03825f9
authorJohannes Sixt <j6t@kdbg.org>
Wed, 20 May 2009 20:13:17 +0000 (20 22:13 +0200)
committerJohannes Sixt <j6t@kdbg.org>
Wed, 20 May 2009 20:13:17 +0000 (20 22:13 +0200)
treea7becd900913ab8b911905a3c30cbbbb688c941e
parent9f7d5d0978c912e8ae267c36106ba1b32594f7cb
Fix template type matching algorithm in the presence of wildcards.

The algorithm that chooses a type table among template arguments if the
type table entries have wildcards had two grave bugs:

- The intention is that entries that have wildcards in later positions are
  better matches than those with wildcards in earlier positions. But the
  method that penalized the candidates got this backwards.

- After the penalty of a candidate was found, it was tried to compare it to
  the minimal penalty so far. But if a new minimum was found, it was
  forgotten to update that minimum. As a consequence, the last candidate
  was always chosen.

These bugs are now fixed. The vector<*> and vector<bool,*> templates were
used to test this algorithm, but that the correct candidate was always
chosen was just coincidence.
kdbg/typetable.cpp