g++ choosing wrong cast
D. Bernstein
dan@cssgroup.com
Wed Feb 11 14:15:00 GMT 1998
To Whom it May Concern,
In using g++ from egcs-1.0.1, I have the following class:
class MSLString
{
private:
operator char *() const ;
...
public:
operator const char *() const ;
...
} ;
when I make a call involving a const char *, e.g. system call
strlen(const char *s), The compiler chooses the WRONG cast,
extern size_t strlen(const char *) ;
MSLString s ;
if (strlen(s) > 0) ...
I get a compiler error about "operator char *() is private within this context".
--
Daniel J. Bernstein
Partner, Computer Science Services Group, LLC
E: dan@cssgroup.com
V: 316.269.9090
F: 316.269.2650
W: http://www2.southwind.net/~css
Obligatory quote:
"A lot has been said about politics; some of it complimentary,
but most of it accurate."
-- Eric Idle
More information about the Gcc-bugs
mailing list