This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/27215] New: fails to resolve
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Apr 2006 12:11:19 -0000
- Subject: [Bug c++/27215] New: fails to resolve
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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