Skip to content

Commit

Permalink
COMP: Fix compile error in MSVC permissive mode
Browse files Browse the repository at this point in the history
This gets triggered when MSVC is used with `/std:c++17 /permissive-` flags.

C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesEstimator.hxx(63,23): error C2672: 'min': no matching overloaded function found
(compiling source file '../../test/itkANTSRegistrationTest.cxx')
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\utility(108,26):
could be '_Ty std::min(std::initializer_list<_Elem>)'
	C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesEstimator.hxx(63,23):
	'_Ty std::min(std::initializer_list<_Elem>)': expects 1 arguments - 2 provided
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\utility(105,26):
or       '_Ty std::min(std::initializer_list<_Elem>,_Pr)'
	C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesEstimator.hxx(63,23):
	'_Ty std::min(std::initializer_list<_Elem>,_Pr)': could not deduce template argument for 'std::initializer_list<_Elem>' from 'TInternalComputationValueType'
        with
        [
            TInternalComputationValueType=float
        ]
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\utility(98,6):
or       'const _Ty &std::min(const _Ty &,const _Ty &) noexcept(<expr>)'
	C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesEstimator.hxx(63,23):
	'const _Ty &std::min(const _Ty &,const _Ty &) noexcept(<expr>)': template parameter '_Ty' is ambiguous
		C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesEstimator.hxx(63,23):
		could be 'double'
		C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesEstimator.hxx(63,23):
		or       'TInternalComputationValueType'
        with
        [
            TInternalComputationValueType=float
        ]
	C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesEstimator.hxx(63,23):
	'const _Ty &std::min(const _Ty &,const _Ty &) noexcept(<expr>)': could not deduce template argument for 'const _Ty &' from 'const double'
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\utility(88,33):
or       'const _Ty &std::min(const _Ty &,const _Ty &,_Pr) noexcept(<expr>)'
	C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesEstimator.hxx(63,23):
	'const _Ty &std::min(const _Ty &,const _Ty &,_Pr) noexcept(<expr>)': expects 3 arguments - 2 provided
C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesEstimator.hxx(63,23):
the template instantiation context (the oldest one first) is
	C:\Dev\ANTsWasm\test\itkANTSRegistrationTest.cxx(273,12):
	see reference to function template instantiation 'int doTest<float>(int,char *[])' being compiled
	C:\Dev\ANTsWasm\test\itkANTSRegistrationTest.cxx(239,14):
	see reference to function template instantiation 'int `anonymous-namespace'::doTest<float,2>(int,char *[])' being compiled
	C:\Dev\ANTsWasm\test\itkANTSRegistrationTest.cxx(74,24):
	see reference to class template instantiation 'itk::ANTSRegistration<ImageType,ImageType,float>' being compiled
	C:\Dev\ANTsWasm\include\itkANTSRegistration.h(288,62):
	see reference to class template instantiation 'ants::RegistrationHelper<TParametersValueType,2>' being compiled
        with
        [
            TParametersValueType=float
        ]
	C:\Dev\ANTsWasm\VS22\_deps\ants_inner-src\Examples\itkantsRegistrationHelper.h(140,38):
	see reference to class template instantiation 'itk::ImageRegistrationMethodv4<itk::Image<float,2>,itk::Image<float,2>,itk::AffineTransform<float,2>,itk::Image<float,2>,itk::PointSet<unsigned int,2,itk::DefaultStaticMeshTraits<TPixelType,2,2,float,float,TPixelType>>>' being compiled
        with
        [
            TPixelType=unsigned int
        ]
	C:\Dev\ITK-git\Modules\Registration\RegistrationMethodsv4\include\itkImageRegistrationMethodv4.hxx(38,1):
	while compiling class template member function 'itk::ImageRegistrationMethodv4<itk::Image<float,2>,itk::Image<float,2>,itk::AffineTransform<float,2>,itk::Image<float,2>,itk::PointSet<unsigned int,2,itk::DefaultStaticMeshTraits<TPixelType,2,2,float,float,TPixelType>>>::ImageRegistrationMethodv4(void)'
        with
        [
            TPixelType=unsigned int
        ]
		C:\Dev\ITK-git\Modules\Registration\RegistrationMethodsv4\include\itkImageRegistrationMethodv4.h(129,3):
		see the first reference to 'itk::ImageRegistrationMethodv4<itk::Image<float,2>,itk::Image<float,2>,itk::AffineTransform<float,2>,itk::Image<float,2>,itk::PointSet<unsigned int,2,itk::DefaultStaticMeshTraits<TPixelType,2,2,float,float,TPixelType>>>::ImageRegistrationMethodv4' in 'itk::ImageRegistrationMethodv4<itk::Image<float,2>,itk::Image<float,2>,itk::AffineTransform<float,2>,itk::Image<float,2>,itk::PointSet<unsigned int,2,itk::DefaultStaticMeshTraits<TPixelType,2,2,float,float,TPixelType>>>::New'
        with
        [
            TPixelType=unsigned int
        ]
		C:\Dev\ITK-git\Modules\Registration\RegistrationMethodsv4\include\itkImageRegistrationMethodv4.h(129,3):
		see the first reference to 'itk::ImageRegistrationMethodv4<itk::Image<float,2>,itk::Image<float,2>,itk::AffineTransform<float,2>,itk::Image<float,2>,itk::PointSet<unsigned int,2,itk::DefaultStaticMeshTraits<TPixelType,2,2,float,float,TPixelType>>>::New' in 'itk::ImageRegistrationMethodv4<itk::Image<float,2>,itk::Image<float,2>,itk::AffineTransform<float,2>,itk::Image<float,2>,itk::PointSet<unsigned int,2,itk::DefaultStaticMeshTraits<TPixelType,2,2,float,float,TPixelType>>>::CreateAnother'
        with
        [
            TPixelType=unsigned int
        ]
	C:\Dev\ITK-git\Modules\Registration\RegistrationMethodsv4\include\itkImageRegistrationMethodv4.hxx(82,54):
	see reference to class template instantiation 'itk::RegistrationParameterScalesFromPhysicalShift<DefaultMetricType>' being compiled
	C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesFromPhysicalShift.h(36,12):
	see reference to class template instantiation 'itk::RegistrationParameterScalesFromShiftBase<TMetric>' being compiled
        with
        [
            TMetric=DefaultMetricType
        ]
	C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesFromShiftBase.h(45,12):
	see reference to class template instantiation 'itk::RegistrationParameterScalesEstimator<TMetric>' being compiled
        with
        [
            TMetric=DefaultMetricType
        ]
	C:\Dev\ITK-git\Modules\Numerics\Optimizersv4\include\itkRegistrationParameterScalesEstimator.hxx(52,1):
	while compiling class template member function 'TInternalComputationValueType itk::RegistrationParameterScalesEstimator<TMetric>::EstimateMaximumStepSize(void)'
        with
        [
            TInternalComputationValueType=float,
            TMetric=DefaultMetricType
        ]
  • Loading branch information
dzenanz authored and hjmjohnson committed Mar 3, 2024
1 parent 03f250d commit 634cbdc
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ RegistrationParameterScalesEstimator<TMetric>::EstimateMaximumStepSize() -> Floa

for (SizeValueType d = 0; d < dim; ++d)
{
minSpacing = std::min(minSpacing, spacing[d]);
minSpacing = std::min<FloatType>(minSpacing, spacing[d]);
}

return minSpacing;
Expand Down

0 comments on commit 634cbdc

Please sign in to comment.