Christopher Zimmermann <madro...@zakweb.de> writes: > Hi, > > the following piece of code compiles fine using g++ 4.2.4, but > fails using g++ 3.3.5 in the base system: > > error: operands to ?: have different types
How about something like this... #include<err.h> // #define WarnIfNULL(x) ((x) ? (x) : (warn("blub"),(x))) template<class T> inline T WarnIfNULL(T x) { if (!x) warnx("blub"); return x; } class A { protected: A() : a(0) {} // A() : a(1) {} int a; }; class B : A { public: void blub() { WarnIfNULL(A::a); } }; int main() { B b; b.blub(); return 0; } -- Mike Small sma...@panix.com