[Bug c++/25855] template specialisation not always found

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Jan 19 13:15:00 GMT 2006



------- Comment #4 from rguenth at gcc dot gnu dot org  2006-01-19 13:15 -------
So, for

template <typename T>  int qCompare(const T *t1, const T *t2) { return 1; }
template <typename T>  int qCompare(T *t1, T *t2) { return 2; }
template <typename T1, typename T2> int qCompare(const T1 *t1, const T2 *t2) {
return 3; }
template<> int qCompare(const char *t1, const char *t2) { return 4; }
int main()
{
  return qCompare("a", "b");
}

gcc returns 1, if you swap the first two decls it returns 4, likewise if you
remove the function that returns 3 regardless of ordering of the first two
lines.

So, the bug is it should unconditionally return 4 or diagnose the ambiguous
specialization.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-01-19 13:15:22
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25855



More information about the Gcc-bugs mailing list