https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67358
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Not a bug, that's how C++ works. The argument p is a non-const int, so binding const int& requires a qualification conversion. The function template deduces the parameter type as int& which is an exact match requiring no conversion, so is a better conversion sequence. I suggest asking this kind of question somewhere like stackoverflow.com instead of reporting a bug.