kenny@uiucdcsb.UUCP (10/01/87)
HELP! I'm at wit's end with the following problem; I can't even find a workaround (it seems that any way I spell it, the problem stays). Consider the following (highly stripped-down) program: ------------------------------------------------------------------------ 1 #include <stream.h> 2 3 struct alpha { 4 alpha () { } 5 operator double () { return 0.0; } 6 }; 7 istream & operator >> (istream &, alpha &); 8 9 struct beta { 10 }; 11 12 class gamma : public beta { 13 public: 14 void gamma_entry (alpha &, beta &); 15 }; 16 17 main () { 18 alpha a; 19 beta b; 20 gamma g; 21 g.gamma_entry (a, b); 22 cin >> a; 23 g.gamma_entry (a, b); 24 } ------------------------------------------------------------------------ An attempt to compile, on either 1.1 or 1.2, results in: ------------------------------------------------------------------------ %CC -c bug.c CC bug.c: "bug.c", line 23: error: ambiguous operand types void gamma::(alpha &, beta &) beta for function call "bug.c", line 24: warning: g used but not set 1 error ------------------------------------------------------------------------ Removing either the ``cin >> a'' at line 22 or the ``operator double'' declaration at line 5 seems to get rid of the problem. What's the compiler complaining about, and how can I get around it? I can't even make sense of the error message! Kevin Kenny UUCP: {ihnp4,pur-ee,convex}!uiucdcs!kenny Department of Computer Science ARPA: kenny@B.CS.UIUC.EDU (kenny@UIUC.ARPA) University of Illinois CSNET: kenny@UIUC.CSNET 1304 W. Springfield Ave. Urbana, Illinois, 61801 Voice: (217) 333-8740