www.digitalmars.com         C & C++   DMDScript  

c++.beta - Error: ambiguous reference to symbol

reply steve <steve_member pathlink.com> writes:
The following code (line 7 and 8) causes the Error: ambiguous reference to
symbol

#include <iostream>

int main()
{
enum { zero, one, two, three };

std::cout << zero << " ";
std::cout << one << "\n";

return 0;
}

Low priority.

Steve
Jan 22 2003
parent Richard Grant <fractal clark.net> writes:
#include <iostream>

int main()
{
enum { zero, one, two, three };

std::cout << zero << " ";
Here's a more isolated case: void fn(bool i) { } void fn(unsigned char i) { } void fn(void (*f)()) { } int main() { enum { zero, one, two, three }; fn(zero); // Error: ambiguous reference to symbol // Had: fn(bool ) // and: fn(void (*C func)()) fn(one); // Error: ambiguous reference to symbol // Had: fn(bool ) // and: fn(unsigned char ) return 0; } both are fairly bizzarre. Clearly a problem with automatic type conversion. My guess is that it is suppossed to be the underlying type that is used for conversion. This should be an integer according to 7.2-5. sizeof "zero" is 4. Richard
Jan 23 2003