Uploaded image for project: 'XalanC'
  1. XalanC
  2. XALANC-699

Compile using Visual C++ 2010 (VC10)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • CurrentCVS
    • CurrentCVS
    • XalanC
    • None
    • Visual C++ 2010 (VC10) on Windows 7

    Description

      VC10 gives the following compile error for the current trunk of Xalan-C:

      2> StylesheetExecutionContextDefault.cpp
      2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(163): error C2440: 'initializing' : cannot convert from 'int' to 'xercesc_3_0::MemoryManager *'
      2> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
      2> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(247) : see reference to function template instantiation 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base<_Ty,_Ty>(_Other1 &&,_Other2 &&)' being compiled
      2> with
      2> [
      2> _Ty1=xercesc_3_0::MemoryManager *,
      2> _Ty2=xalanc_1_11::XalanSourceTreeDocument *,
      2> _Ty=int,
      2> _Other1=int,
      2> _Other2=int
      2> ]
      2> D:\dev\vc10\PIE\xml-xalan\src\xalanc/Include/XalanMemMgrAutoPtr.hpp(58) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<int,int>(_Other1 &&,_Other2 &&)' being compiled
      2> with
      2> [
      2> _Ty1=xercesc_3_0::MemoryManager *,
      2> _Ty2=xalanc_1_11::XalanSourceTreeDocument *,
      2> _Other1=int,
      2> _Other2=int
      2> ]
      2> D:\dev\vc10\PIE\xml-xalan\src\xalanc/Include/XalanMemMgrAutoPtr.hpp(56) : while compiling class template member function 'xalanc_1_11::XalanMemMgrAutoPtr<Type>::MemMgrAutoPtrData::MemMgrAutoPtrData(void)'
      2> with
      2> [
      2> Type=xalanc_1_11::XalanSourceTreeDocument
      2> ]
      2> D:\dev\vc10\PIE\xml-xalan\src\xalanc/Include/XalanMemMgrAutoPtr.hpp(210) : see reference to class template instantiation 'xalanc_1_11::XalanMemMgrAutoPtr<Type>::MemMgrAutoPtrData' being compiled
      2> with
      2> [
      2> Type=xalanc_1_11::XalanSourceTreeDocument
      2> ]
      2> d:\dev\vc10\pie\xml-xalan\src\xalanc\xslt\StylesheetExecutionContextDefault.hpp(1115) : see reference to class template instantiation 'xalanc_1_11::XalanMemMgrAutoPtr<Type>' being compiled
      2> with
      2> [
      2> Type=xalanc_1_11::XalanSourceTreeDocument
      2> ]
      2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(163): error C2439: 'std::_Pair_base<_Ty1,_Ty2>::first' : member could not be initialized
      2> with
      2> [
      2> _Ty1=xercesc_3_0::MemoryManager *,
      2> _Ty2=xalanc_1_11::XalanSourceTreeDocument *
      2> ]
      2> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(166) : see declaration of 'std::_Pair_base<_Ty1,_Ty2>::first'
      2> with
      2> [
      2> _Ty1=xercesc_3_0::MemoryManager *,
      2> _Ty2=xalanc_1_11::XalanSourceTreeDocument *
      2> ]
      2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(163): error C2440: 'initializing' : cannot convert from 'int' to 'xalanc_1_11::XalanSourceTreeDocument *'
      2> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
      2>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(163): error C2439: 'std::_Pair_base<_Ty1,_Ty2>::second' : member could not be initialized
      2> with
      2> [
      2> _Ty1=xercesc_3_0::MemoryManager *,
      2> _Ty2=xalanc_1_11::XalanSourceTreeDocument *
      2> ]
      2> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\utility(167) : see declaration of 'std::_Pair_base<_Ty1,_Ty2>::second'
      2> with
      2> [
      2> _Ty1=xercesc_3_0::MemoryManager *,
      2> _Ty2=xalanc_1_11::XalanSourceTreeDocument *
      2> ]

      The following patch is fixed the build.

      ===================================================================
      — src/xalanc/Include/XalanMemMgrAutoPtr.hpp (revision 940963)
      +++ src/xalanc/Include/XalanMemMgrAutoPtr.hpp (working copy)
      @@ -54,7 +54,11 @@
      public:

      MemMgrAutoPtrData():
      +#ifdef _NATIVE_NULLPTR_SUPPORTED
      + AutoPtrPairType(nullptr,nullptr)
      +#else
      AutoPtrPairType(0,0)
      +#endif
      {
      }

      nullptr is a C++0x feature, "_NATIVE_NULLPTR_SUPPORTED" is defined in "C:\Program Files\Microsoft Visual Studio 10.0\VC\include\stddef.h" and it is the symbol being checked for in other VC10 headers.
      I'm not aware of any clean or portable way to detect presence of the nullptr.

      Attachments

        Activity

          People

            dbertoni David N Bertoni
            ipechorin Ivan Pechorin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: