KDE/kdelibs/kjs

Peter Kümmel syntheticpp at gmx.net
Sat Feb 18 13:01:08 CET 2006


Dirk Mueller wrote:
> On Thursday, 16. February 2006 18:43, Darin Adler wrote:
> 
>> our research I'm pretty sure that GCC does not match the standard in
>> this respect, and MSVC does. But of course we could be wrong.
> 
> I don't actually know what you tried to fix with this hack, because for me 
> (using GCC 4.1.x SVN) it works both with and without your hack, but gcc 
> implements the defect reports of the C++ standard, while MSVC does not. 
> 
> However, all is difficult to say without a concrete testcase. do you have one?
> 
> 

Here is a test case:


#define ON

#ifdef ON
#define PP ::
#else
#define PP
#endif

struct A {};
struct B : A {};

template<class T>
A* creator()
{
    return new T;
}

namespace KJS
{
    struct C : A
    {
        friend A* PP creator<C>();

        A* getAPtr()
        {
            return PP creator<C>();
        }

    private:
        C(){}
    };

}

int main()
{
    return 0;
}


and the results:

only compiles when :: is ON/OFF

gcc 3.4.4: OFF
gcc 4.0.2: OFF
msvc 8.0 : ON


Regards,
Peter








More information about the Khtml-devel mailing list