Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation warning for MSVC #85

Merged
merged 1 commit into from
Jan 12, 2018

Conversation

cezheng
Copy link
Contributor

@cezheng cezheng commented Jan 11, 2018

When instantiating the template function fill with float/double, MSVC will emit an warning.

Version: VC++ 14.0.

xutility(2766): error C2220: warning treated as error - no 'object' file generated
e:\\google3\\third_party\\msvc\\vc_14_0\\files\\vc\\include\xutility(2780): note: see reference to function template instantiation 'void std::_Fill_unchecked1<_FwdIt,_Ty>(_FwdIt,_FwdIt,const _Ty &,std::false_type)' being compiled
        with
        [
            _FwdIt=float *,
            _Ty=int
        ]
xutility(2788): note: see reference to function template instantiation 'void std::_Fill_unchecked<float*,_Ty>(_FwdIt,_FwdIt,const _Ty &)' being compiled
        with
        [
            _Ty=int,
            _FwdIt=float *
        ]
kdtree_cpu.cpp(344): note: see reference to function template instantiation 'void std::fill<std::_Vector_iterator<std::_Vector_val<std::_Simple_types<float>>>,int>(_FwdIt,_FwdIt,const _Ty &)' being compiled
        with
        [
            _FwdIt=std::_Vector_iterator<std::_Vector_val<std::_Simple_types<float>>>,
            _Ty=int
        ]
kdtree_cpu.cpp(343): note: while compiling class template member function 'unsigned long Nabo::KDTreeUnbalancedPtInLeavesImplicitBoundsStackOpt<float,Nabo::IndexHeapSTL<int,float>,Eigen::Matrix<float,-1,-1,0,-1,-1>>::onePointKnn(const Eigen::Matrix<float,-1,-1,0,-1,-1> &,Eigen::Matrix<int,-1,-1,0,-1,-1> &,Eigen::Matrix<float,-1,-1,0,-1,-1> &,int,Heap &,std::vector<T,std::allocator<_Ty>> &,const T,const T,const bool,const bool,const bool) const'
        with
        [
            Heap=Nabo::IndexHeapSTL<int,float>,
            T=float,
            _Ty=float
        ]
kdtree_cpu.cpp(452): note: see reference to class template instantiation 'Nabo::KDTreeUnbalancedPtInLeavesImplicitBoundsStackOpt<float,Nabo::IndexHeapSTL<int,float>,Eigen::Matrix<float,-1,-1,0,-1,-1>>' being compiled
xutility(2766): warning C4244: '=': conversion from 'const int' to 'float', possible loss of data

When instantiating the template function fill with float/double, MSVC will emit an error.
@ethzasl-jenkins
Copy link

Can one of the admins verify this patch?

Copy link
Collaborator

@simonlynen simonlynen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@HannesSommer
Copy link
Collaborator

ok to test

@HannesSommer HannesSommer merged commit f664579 into norlab-ulaval:master Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants