kjs: compile bug under msvc 7.1

Maksim Orlovich mo85 at cornell.edu
Tue Jul 17 16:01:36 BST 2007


>> Looks like msvc does not recognize that StatementNode is derived from
>> Node. Maybe try to give the compiler a hint
>>         new (end()) T(static_cast<T>(*ptr));
>> or
>>         new (end()) T(const_cast<U>(*ptr));
>> or both
>>
>> Can't test it here as I don't have msvc7.1 available.
>
> This code with explicit downcast compiles well. Is it OK for gcc as well?

Ugh. Please don't do this, this may require cast operators and such and
generally looks suspect.  Any chance
+        new (end()) T(*static_cast<T*>(ptr));

works for you?


>
> Index: kjs/wtf/Vector.h
> ===================================================================
> --- kjs/wtf/Vector.h	(revision 688945)
> +++ kjs/wtf/Vector.h	(working copy)
> @@ -549,10 +549,7 @@
>           const U* ptr = &val;
>           if (size() == capacity())
>               ptr = expandCapacity(size() + 1, ptr);
> -#if !defined(_MSC_VER)
> -        //TODO this does not compile for msvc 7.1
> -        new (end()) T(*ptr);
> -#endif
> +        new (end()) T(static_cast<T>(*ptr));
>           ++m_size;
>       }
>
> --
> regards / pozdrawiam, Jaroslaw Staniek
>   Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work
> on
>   Kexi & KOffice: http://www.kexi.pl/en, http://www.koffice.org
>   KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com,
> http://www.kde.org
>
>






More information about the kde-core-devel mailing list