K
Karol Szkudlarek
Hello C++ fans!
Why the following program does not compile on my box:
typedef int my_int;
class A
{
public:
enum Items
{
item1=1000,
item2=2000
};
//typedef int my_int;
int foo(const my_int&)
{
return 0;
}
int foo(const bool&)
{
return 0;
}
};
int main()
{
A a;
a.foo(A::item1);
return 0;
}
it returns errors:
testtypedef.cpp: In function `int main()':
testtypedef.cpp:27: error: call of overloaded `foo(A::Items)' is ambiguous
testtypedef.cpp:15: error: candidates are: int A::foo(const my_int&)
testtypedef.cpp:19: error: int A::foo(const bool&)
but when I comment first line (typedef...) and uncomment 13 (typedef)
line compiles fine. I can't explain such behaviour.
Karol Szkudlarek
ps.
Compiler on my box: gcc (3.3.3)
Why the following program does not compile on my box:
typedef int my_int;
class A
{
public:
enum Items
{
item1=1000,
item2=2000
};
//typedef int my_int;
int foo(const my_int&)
{
return 0;
}
int foo(const bool&)
{
return 0;
}
};
int main()
{
A a;
a.foo(A::item1);
return 0;
}
it returns errors:
testtypedef.cpp: In function `int main()':
testtypedef.cpp:27: error: call of overloaded `foo(A::Items)' is ambiguous
testtypedef.cpp:15: error: candidates are: int A::foo(const my_int&)
testtypedef.cpp:19: error: int A::foo(const bool&)
but when I comment first line (typedef...) and uncomment 13 (typedef)
line compiles fine. I can't explain such behaviour.
Karol Szkudlarek
ps.
Compiler on my box: gcc (3.3.3)