compile or not compile
Karo Szkudlarek
karol@mikronika.com.pl
Thu Jul 1 13:42:00 GMT 2004
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
More information about the Gcc-help
mailing list