This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/24628] New: const-over-non-const identification fails
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Nov 2005 01:17:18 -0000
- Subject: [Bug c++/24628] New: const-over-non-const identification fails
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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