template<typename T> void foo(T& t) {} template<typename T> void foo(const T& t) {}
template<typename U, int n, typename T> void bar(T& t) {} template<typename U, int n, typename T> void bar(const T& t) {} int main() { int i; const int j = 0; foo(i); foo(j); bar<bool, 5>(i); bar<bool, 5>(j); } gets you foo.cc: In function `int main()': foo.cc:17: error: call of overloaded `bar(const int&)' is ambiguous foo.cc:7: note: candidates are: void bar(T&) [with U = bool, int n = 5, T = const int] foo.cc:9: note: void bar(const T&) [with U = bool, int n = 5, T = int] -- Summary: const-over-non-const identification fails Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: igodard at pacbell dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24628