This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
compile or not compile
- From: Karo Szkudlarek <karol at mikronika dot com dot pl>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 01 Jul 2004 15:42:36 +0200
- Subject: compile or not compile
Hi!
The following program:
include <iostream>
typedef int my_int;
class A
{
public:
enum Items
{
item1=1000,
item2=2000
};
// typedef int my_int;
int foo(const my_int&)
{
std::cerr << "int\n";
return 0;
}
int foo(const bool&)
{
std::cerr << "bool\n";
return 0;
}
};
int main()
{
A a;
a.foo(A::item1);
return 0;
}
on my platform (Suse Linux, gcc 3.3.3) does not compile. Returns errors:
testtypedef.cpp: In function `int main()':
testtypedef.cpp:30: error: call of overloaded `foo(A::Items)' is ambiguous
testtypedef.cpp:16: error: candidates are: int A::foo(const my_int&)
testtypedef.cpp:21: error: int A::foo(const bool&)
I posted my problem to compl.lang.c++ and I got answer that
reason for this is compiler bug. I don't know how can I avoid it.
My program compiles fine on another linuxes with gcc 3.3.3 for
example gentoo and debian. Also I posted my problem to Suse support
but got answer that:
"So far, we are not aware about any problem in this package."
says about gcc package.
Any ideas what can I do now? Is it compiler bug or not... I am very
confused...
Greets,
Karol Szkudlarek