InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.43k stars 668 forks source link

ITK 5.3.0 Does not compile on Windows using Visual Studio 17 2022 x64 #4358

Open imikejackson opened 1 year ago

imikejackson commented 1 year ago
FAILED: complex/Plugins/ITKImageProcessing/CMakeFiles/ITKImageProcessing.dir/Debug/src/ITKImageProcessing/Filters/ITKMorphologicalWatershedImage.cpp.obj
C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1438~1.331\bin\Hostx64\x64\cl.exe  /nologo /TP -DCOMPLEX_ENABLE_MULTICORE -DEbsdLib_BUILT_AS_DYNAMIC_LIB -DFMT_SHARED -DH5Support_USE_MUTEX -DH5_BUILT_AS_DYNAMIC_LIB -DH5_USE_110_API -DITKImageProcessing_EXPORTS -DTBB_USE_DEBUG -D_SILENCE_CXX17_RESULT_OF_DEPRECATION_WARNING -DCMAKE_INTDIR=\"Debug\" -IE:\Workspace1\complex\src\Plugins\ITKImageProcessing\src -IE:\Workspace1\DREAM3D-Build\NX-ninja-v143\complex\Plugins\ITKImageProcessing\generated -IE:\Workspace1\complex\src -IE:\Workspace1\DREAM3D-Build\NX-ninja-v143\complex\generated -external:IE:\Workspace1\vcpkg-installed-v143\x64-windows\include -external:IE:\Workspace1\vcpkg-installed-v143\x64-windows\share\eigen3\..\..\include\eigen3 -external:IE:\Workspace1\vcpkg-installed-v143\x64-windows\include\ITK-5.3 -external:W0 /DWIN32 /D_WINDOWS /EHsc /Ob0 /Od /RTC1 -std:c++17 -MDd -Zi /wd4275 /wd4251 /we4706 /we4715 /we4456 /we4457 /we4458 /we4459 /permissive- /MP /bigobj /showIncludes /Focomplex\Plugins\ITKImageProcessing\CMakeFiles\ITKImageProcessing.dir\Debug\src\ITKImageProcessing\Filters\ITKMorphologicalWatershedImage.cpp.obj /Fdcomplex\Plugins\ITKImageProcessing\CMakeFiles\ITKImageProcessing.dir\Debug\ /FS -c E:\Workspace1\complex\src\Plugins\ITKImageProcessing\src\ITKImageProcessing\Filters\ITKMorphologicalWatershedImage.cpp
E:\Workspace1\vcpkg-installed-v143\x64-windows\include\ITK-5.3\itkShapedNeighborhoodIterator.h(182): error C2516: 'itk::ShapedNeighborhoodIterator<TImage,TBoundaryCondition>::ConstIterator': is not a legal base class
E:\Workspace1\vcpkg-installed-v143\x64-windows\include\ITK-5.3\itkShapedNeighborhoodIterator.h(171): note: see declaration of 'itk::ShapedNeighborhoodIterator<TImage,TBoundaryCondition>::ConstIterator'
E:\Workspace1\vcpkg-installed-v143\x64-windows\include\ITK-5.3\itkShapedNeighborhoodIterator.h(182): note: the template instantiation context (the oldest one first) is
E:\Workspace1\vcpkg-installed-v143\x64-windows\include\ITK-5.3\itkShapedNeighborhoodIterator.h(265): note: see reference to class template instantiation 'itk::ShapedNeighborhoodIterator<TImage,TBoundaryCondition>' being compiled        
E:\Workspace1\vcpkg-installed-v143\x64-windows\include\ITK-5.3\itkShapedNeighborhoodIterator.h(209): note: see reference to class template instantiation 'itk::ShapedNeighborhoodIterator<TImage,TBoundaryCondition>::Iterator' being compiled

Looks like it is this: https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-2/compiler-error-c2516?view=msvc-170

and looks like in those files there is that exact situation.

When can we get a fix and an ITK 5.3.1 release?

dzenanz commented 1 year ago

I think that ITK 5.3.0 compiles with an older VS2022. ITK 5.4 final is around the corner, you can try 5.4RC2.

N-Dekker commented 1 year ago

Thanks for reporting this issue. It should be addressed by commit 687f51e64287615aac4108f867c264ac4e53dd07, from:

N-Dekker commented 1 year ago

Please vote if you find it an important compiler bug:

Class template gets undeserved error C2516: "is not a legal base class" from /permissive- ("Conformance mode") https://developercommunity.visualstudio.com/t/Class-template-gets-undeserved-error-C25/10243790