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
COMP: Fix MSVC error C2516: 'ConstIterator': is not a legal base class #3844
COMP: Fix MSVC error C2516: 'ConstIterator': is not a legal base class #3844
Conversation
Thanks to Bernhard Froehler (@codeling) for confirming that the errors go away with this fix, at https://discourse.itk.org/t/itk-build-error-in-itk-shapedneighborhooditerator/4861/19 |
@@ -179,7 +179,7 @@ class ITK_TEMPLATE_EXPORT ShapedNeighborhoodIterator | |||
using typename Superclass::IndexValueType; | |||
|
|||
/** An iterator for the ShapedNeighborhood classes. */ | |||
struct Iterator : public ConstIterator | |||
struct Iterator : public Superclass::ConstIterator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Instead of this adjustment (deriving from Superclass::ConstIterator
), we could also restore using ConstIterator = typename Superclass::ConstIterator;
as in
using ConstIterator = typename Superclass::ConstIterator; |
It looks like these MSVC /permissive-
errors were triggered by pull request #2567 commit 4f30980 "STYLE: Avoid repeating parent aliases", merged on September 21, 2021. I still think it may be an MSVC compiler bug anyway.
PR converted back to draft, because this error appears elsewhere in ITK as well, when doing ITK/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.h Lines 131 to 132 in ac019e3
|
Works around compile errors that appeared using Visual C++ compiler flag `/permissive-` ("Conformance mode"), using either VS2019 or VS2022, saying: > error C2516: 'ConstIterator': is not a legal base class > error C2516: 'GlobalDataStruct': is not a legal base class Originally reported by Astha, March 14, 2022, and further discussed at "ITK build Error in itk::ShapedNeighborhoodIterator", https://discourse.itk.org/t/itk-build-error-in-itk-shapedneighborhooditerator/4861
872fa19
to
ad1277b
Compare
Please check the bug report I submitted to Microsoft on this compile error: Class template gets undeserved error C2516: "is not a legal base class" from https://developercommunity.visualstudio.com/t/Class-template-gets-undeserved-error-C25/10243790 |
Originally reported by Astha, March 14, 2022, and further discussed at "ITK build Error in itk::ShapedNeighborhoodIterator", https://discourse.itk.org/t/itk-build-error-in-itk-shapedneighborhooditerator/4861