COMP: Fix Variadic Input Image Filters for g++8.2.0
Summary
Fix two compilation errors with GCC 8.2.0 and other recent C++ compilers.
Rationale
Eventually, these compilers will be used by others
Implementation Details
Current C++ standards require ambiguities to be resolved where templates are used, usually with typename
or this->
. Here a more obscure resolution is required with template functioname(real_parameters)
to call template functions.
Hopefully it may be simplified in a future standard. In the mean time, we must cope with it.
The actual error messages
With recent compilers, these two filters present the following compilation errors.
[ 62%] Building CXX object Modules/Applications/AppClassification/app/CMakeFiles/otbapp_ZonalStatistics.dir/otbZonalStatistics.cxx.o
In file included from src/otb/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h:23,
from src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.h:24,
from src/otb/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx:41:
src/otb/Modules/Core/Functor/include/otbVariadicInputsImageFilter.h: In member function ‘auto otb::VariadicInputsImageFilter<TOuptut, TInputs>::GetInputsImpl(std::index_sequence<Is ...>)’:
src/otb/Modules/Core/Functor/include/otbVariadicInputsImageFilter.h:154:47: error: expected primary-expression before ‘)’ token
return std::make_tuple(this->GetInput<Is>()...);
^
In file included from src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.h:24,
from src/otb/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx:41:
src/otb/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h: In member function ‘void otb::VariadicNamedInputsImageFilter<TOuptut, TInputNameMap, TInputs>::SetInput(Tag, otb::VariadicNamedInputsImageFilter<TOuptut, TInputNameMap, TInputs>::InputImageType<otb::internal::tuple_index<Tag, TInputNameMap>::value>*)’:
src/otb/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h:141:17: error: expected primary-expression before ‘>’ token
SetInput<Tag>(inputPtr);
^
src/otb/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h: In member function ‘otb::VariadicNamedInputsImageFilter<TOuptut, TInputNameMap, TInputs>::InputImageType<otb::internal::tuple_index<Tag, TInputNameMap>::value>* otb::VariadicNamedInputsImageFilter<TOuptut, TInputNameMap, TInputs>::GetInput(Tag)’:
src/otb/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h:164:24: error: expected primary-expression before ‘>’ token
return GetInput<Tag>();
^
src/otb/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h:164:26: error: expected primary-expression before ‘)’ token
return GetInput<Tag>();
^
In file included from src/otb/Modules/Core/Functor/include/otbVariadicNamedInputsImageFilter.h:23,
from src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.h:24,
from src/otb/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx:41:
src/otb/Modules/Core/Functor/include/otbVariadicInputsImageFilter.h: In instantiation of ‘auto otb::VariadicInputsImageFilter<TOuptut, TInputs>::GetInputsImpl(std::index_sequence<Is ...>) [with long unsigned int ...Is = {0}; TOuptut = otb::VectorImage<float, 2>; TInputs = {otb::Image<int, 2>}; std::index_sequence<Is ...> = std::integer_sequence<long unsigned int, 0>]’:
src/otb/Modules/Core/Functor/include/otbVariadicInputsImageFilter.h:133:72: required from ‘auto otb::VariadicInputsImageFilter<TOuptut, TInputs>::GetInputs() [with TOuptut = otb::VectorImage<float, 2>; TInputs = {otb::Image<int, 2>}]’
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx:298:73: required from ‘void otb::FunctorImageFilter<TFunction, TNameMap>::GenerateInputRequestedRegion() [with TFunction = otb::Wrapper::ZonalStatistics::EncoderFunctorType<int, itk::VariableLengthVector<float> >; TNameMap = void ’
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx:289:6: required from here
src/otb/Modules/Core/Functor/include/otbVariadicInputsImageFilter.h:154:42: error: invalid operands of types ‘<unresolved overloaded function type>’ and ‘long unsigned int’ to binary ‘operator<’
return std::make_tuple(this->GetInput<Is>()...);
~~~~~~~~~~~~~~^~~
In file included from src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.h:500,
from src/otb/Modules/Applications/AppClassification/app/otbZonalStatistics.cxx:41:
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx: In instantiation of ‘void otb::FunctorImageFilter<TFunction, TNameMap>::GenerateInputRequestedRegion() [with TFunction = otb::Wrapper::ZonalStatistics::EncoderFunctorType<int, itk::VariableLengthVector<float> >; TNameMap = void]’:
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx:289:6: required from here
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx:298:73: error: invalid use of void expression
functor_filter_details::SetInputRequestedRegions<InputHasNeighborhood>(this->GetInputs(), requestedRegion, m_Radius);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx: In instantiation of ‘void otb::FunctorImageFilter<TFunction, TNameMap>::GenerateOutputInformation() [with TFunction = otb::Wrapper::ZonalStatistics::EncoderFunctorType<int, itk::VariableLengthVector<float> >; TNameMap = void]’:
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx:302:6: required from here
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx:308:8: error: ‘void inputs’ has incomplete type
auto inputs = this->GetInputs();
^~~~~~
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx: In instantiation of ‘void otb::FunctorImageFilter<TFunction, TNameMap>::ThreadedGenerateData(const OutputImageRegionType&, itk::ThreadIdType) [with TFunction = otb::Wrapper::ZonalStatistics::EncoderFunctorType<int, itk::VariableLengthVector<float> >; TNameMap = void; otb::FunctorImageFilter<TFunction, TNameMap>::OutputImageRegionType = itk::ImageRegion<2>; itk::ThreadIdType = unsigned int]’:
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx:321:6: required from here
src/otb/Modules/Core/Functor/include/otbFunctorImageFilter.hxx:336:62: error: invalid use of void expression
auto inputIterators = functor_filter_details::MakeIterators(this->GetInputs(), outputRegionForThread, m_Radius, InputHasNeighborhood{});
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[5]: *** [Modules/Applications/AppClassification/app/CMakeFiles/otbapp_ZonalStatistics.dir/otbZonalStatistics.cxx.o] Error 1
make[4]: *** [Modules/Applications/AppClassification/app/CMakeFiles/otbapp_ZonalStatistics.dir/all] Error 2
Copyright
The copyright owner is CNES and has signed the ORFEO ToolBox Contributor License Agreement.
Check before merging:
- All discussions are resolved
- At least 2
👍 votes from core developers, no👎 vote. - The feature branch is (reasonably) up-to-date with the base branch
- Dashboard is green
- Copyright owner has signed the ORFEO ToolBox Contributor License Agreement
- Optionally, run
git diff develop... -U0 --no-color | clang-format-diff.py -p1 -i
on latest changes and commit