January 23, 2003 Error: ambiguous reference to symbol | ||||
---|---|---|---|---|
| ||||
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 |
January 23, 2003 Re: Error: ambiguous reference to symbol | ||||
---|---|---|---|---|
| ||||
Posted in reply to steve | >#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
|
Copyright © 1999-2021 by the D Language Foundation