Bug#205402: g++-3.3: typedef handling broken
Package: g++-3.3
Version: 1:3.3.1-1
Severity: normal
g++-3.3 fails to compile the code in test.cc with the following message:
test.cc: In function `int main(int, char**)':
test.cc:22: error: conversion from `BClass' to `B*' is ambiguous
test.cc:16: error: candidates are: BClass::operator B*()
test.cc:9: error: AClass::operator A*()
Although it correctly compiles the equivalent code in test2.cc
-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux maestro 2.4.18-k7 #1 SMP Sáb Ago 9 02:10:04 BRT 2003 i686
Locale: LANG=C, LC_CTYPE=C
Versions of packages g++-3.3 depends on:
ii gcc-3.3 1:3.3.1-1 The GNU C compiler
ii gcc-3.3-base 1:3.3.1-1 The GNU Compiler Collection (base
ii libc6 2.3.2-2 GNU C Library: Shared libraries an
ii libstdc++5-3.3-dev 1:3.3.1-1 The GNU Standard C++ Library v3 (d
-- no debconf information
typedef struct _A A;
typedef struct _A B;
void some_function(B *b);
class AClass {
public:
operator A*() { return 0;}
};
class BClass :public AClass {
public:
operator B*() { return 0;}
};
int main(int argc, char **argv) {
BClass b;
some_function(b);
}
void some_function(struct _A *b);
class AClass {
public:
operator struct _A*() { return 0;}
};
class BClass :public AClass {
public:
operator struct _A*() { return 0;}
};
int main(int argc, char **argv) {
BClass b;
some_function(b);
}
Reply to: