Compile using Visual C++ 2010 (VC10)
------------------------------------

                 Key: XALANC-699
                 URL: https://issues.apache.org/jira/browse/XALANC-699
             Project: XalanC
          Issue Type: New Feature
          Components: XalanC
    Affects Versions: CurrentCVS
         Environment: Visual C++ 2010 (VC10) on Windows 7
            Reporter: Ivan Pechorin
             Fix For: CurrentCVS


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscr...@xml.apache.org
For additional commands, e-mail: xalan-dev-h...@xml.apache.org

Reply via email to