kjs: compile bug under msvc 7.1

Jarosław Staniek js at iidea.pl
Tue Jul 17 12:37:32 BST 2007


Christian Ehrlicher said the following, On 2007-07-14 14:09:

> Jarosław Staniek schrieb:
>> Christian Ehrlicher said the following, On 2007-07-12 20:03:
>>> Jarosław Staniek schrieb:
>>>> Hello,
>>>> Under msvc 7.1 I've got error [1] in this line 
>>>> (kdelibs/kjs/wtf/Vector.h:552):
>>>>
>>>>   new (end()) T(*ptr);
>>>>
>>>> I am looking for sane workaround...
>>>>
>>> What source is compiled when you get this error?
>>
>> kjs\semantic_checker.cpp(83)
>>
> 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?

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