------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-17 16:11 ------- Here is the reduced testcase to make your investigation easier: typedef struct _object PyObject; int PyObject_IsTrue(PyObject *);
class object; typedef PyObject* (object::*bool_type)() const; struct object_base { operator bool_type() const; ~object_base(); PyObject* ptr() const; }; struct object : public object_base { object(); template <class T> explicit object(T const& x) ; }; inline object_base::operator bool_type() const { const object &x = *static_cast<object const*>(this); return PyObject_IsTrue(x.ptr()) ? &object::ptr : 0; } void f(const char *); void argument_error (void) { for (unsigned n = 0; n < 100; ++n) { object kv(""); if (kv) f(""); } } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18040