conversion sequence problem?
gloth@ntwrks.com
gloth@ntwrks.com
Thu Jul 22 17:40:00 GMT 1999
Hi,
When I try to compile the following code fragment:
template<class T>
struct foo {
operator bool () const;
operator T* ();
};
bool bar () {
foo<int> bat;
return bat;
}
with my one-week old gcc-2.95 snapshot, I get the following warning:
foo.cpp: In function `bool bar()':
foo.cpp:9: warning: choosing `foo<int>::operator int *()' over `foo<int>::operator bool() const'
foo.cpp:9: warning: for conversion from `foo<int>' to `bool'
foo.cpp:9: warning: because conversion sequence for the argument is better
I don't have the C++ standard around to check this, but the warning
seems to be wrong for me. The warning goes away if I remove "const".
Comments, anyone?
-Tobi
--
Tobias Gloth - gloth@gmx.net
1625 Discovery Way - Durham, NC 27703 - USA
More information about the Gcc-bugs
mailing list