dnl ---------------------------------------------------------------------------
dnl check if compiler compiles correctly something like this :
dnl class A { virtual A* me(); };
dnl class X {};
dnl class B : public X, public A { virtual B* me(); };
dnl stupid gcc doesn't even bother to warn it can't do it correctly
dnl ---------------------------------------------------------------------------

AC_MSG_CHECKING(if covariant return works)
AC_CACHE_VAL(kde_cv_covariant_return,
    [
    kde_cv_covariant_return=no
    AC_LANG_SAVE
    AC_LANG_CPLUSPLUS
    AC_TRY_RUN( 
        [
        class A { public: virtual A* me(); };
        class X { public: int x; virtual void ff() {}; };
        class B : public X, public A { public: virtual B* me(); };
        int foo( A* a )
            {
            A* aa = a->me();
            return a == aa;
            }
        int main()
            {
            B* b = new B;
            return foo( b ) == 0;
            }
        A* A::me() { return this; }
        B* B::me() { return this; }
        ],
        [ kde_cv_covariant_return=yes ])
    AC_LANG_RESTORE
    ])

if test "$kde_cv_covariant_return" = "no"; then
    AC_MSG_RESULT(no)
    AC_DEFINE(COVARIANT_RETURN_BROKEN, 1,
        [Define if covariant return in virtual methods works])
else
    AC_MSG_RESULT(yes)
fi


dnl ---------------------------------------------------------------------------
dnl check if compiler can compile something like this :
dnl class A { public: void foo( int ); };
dnl class B : public A { public: using A::foo; void foo( char ); }
dnl gcc 2.95.x fails with an error message
dnl ---------------------------------------------------------------------------

AC_MSG_CHECKING(for working using)
AC_CACHE_VAL(kde_cv_working_using,
    [
    kde_cv_working_using=no
    AC_LANG_SAVE
    AC_LANG_CPLUSPLUS
    AC_TRY_COMPILE( 
        [],[
        class A { public: void foo( int ); };
        class B : public A { public: using A::foo; void foo( char ); };
        ],
        [ kde_cv_working_using=yes ])
    AC_LANG_RESTORE
    ])

if test "$kde_cv_working_using" = "yes"; then
    AC_MSG_RESULT(yes)
    AC_DEFINE(HAVE_WORKING_USING, 1,
        [Define if the using keyword works correctly])
else
    AC_MSG_RESULT(no)
fi
