enum A{b,c}; enum M{n,o}; class foo { public: operator A() { return b; } operator int() { return 0; } }; int main() { foo a; unsigned int x = a; }
gets you: ~/ootbc/sim/test$ g++ foo.cc foo.cc: In function `int main()': foo.cc:10: error: conversion from `foo' to `unsigned int' is ambiguous foo.cc:5: note: candidates are: foo::operator A() foo.cc:6: note: foo::operator int() However, the path foo->int->unsigned int is shorter than the path foo->A->int->unsigned int, so the former should be chosen. Ivan -- Summary: fails to resolve Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: igodard at pacbell dot net http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27215