This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11329] New: Compiler cannot find user defined implicit typecast
- From: "jan at planet dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jun 2003 13:42:05 -0000
- Subject: [Bug c++/11329] New: Compiler cannot find user defined implicit typecast
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11329
Summary: Compiler cannot find user defined implicit typecast
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jan at planet dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC 3.3 does not find the user defined typcast in the appended code. In gcc 2.95.3
and Borland C++ 6 it does work.
Compiling with "g++ bugsim2.cc" failes with:
*****
bugsim2.cc: In function `int main()':
bugsim2.cc:27: error: could not convert `super' to `Base&'
bugsim2.cc:21: error: in passing argument 1 of `void funcNonConst(Base&,
Derived&, const Base*)'
*****
gcc -v:
bugsim2.cc: In function `int main()':
bugsim2.cc:27: error: could not convert `super' to `Base&'
bugsim2.cc:21: error: in passing argument 1 of `void funcNonConst(Base&,
Derived&, const Base*)'
uname -a:
Linux earth 2.4.20-4GB #1 Wed Jun 18 07:45:45 UTC 2003 i686 unknown unknown
GNU/Linux
Standard SuSE 8.2 on Pentium 4.
******************************
class Base {
};
class Derived: public Base {
};
class Super {
public:
Derived *derived;
Super(): derived(new Derived) {}
~Super() { delete derived; }
Base *pointer() const { return derived; }
operator Base &() const { return *derived; }
operator Derived &() const { return *derived; }
};
void funcNonConst(Base &base, Derived &derived, const Base *orig)
{
}
int main()
{
Super super;
funcNonConst(super, super, super.pointer());
}