OpenImageIO: new ArgParse code does not build with VS2015

After commit e81036b6559 (#2531), I can no longer build on Windows using VS2015 because I get build errors of the form:

oiio\src\oiiotool\oiiotool.cpp(5244): error C2664: 'OpenImageIO_v2_2::ArgParse::Arg &OpenImageIO_v2_2::ArgParse::Arg::action(int (__cdecl *)(int,const char **))': cannot convert argument 1 from 'void (__cdecl *)(OpenImageIO_v2_2::span<const char *const ,-1>)' to 'OpenImageIO_v2_2::ArgParse::ArgAction &&'
oiio\src\oiiotool\oiiotool.cpp(5244): note: Reason: cannot convert from 'overloaded-function' to 'OpenImageIO_v2_2::ArgParse::ArgAction'
oiio\src\oiiotool\oiiotool.cpp(5244): note: No constructor could take the source type, or constructor overload resolution was ambiguous

Looking at the code, I can’t see how this could be considered ambiguous and this should work, so I suspect a compiler bug. And in fact, if I build with VS2019 I get no error.

I’m hoping very soon we’ll be building OIIO with a newer compiler than VS2015, so in my particular case I don’t think I need this fixed in OIIO. However, currently the minimum visual studio required, according to the following is 2015:

src/include/OpenImageIO/platform.h
# if _MSC_VER < 1900
 # error "This version of OIIO is meant to work only with Visual Studio 2015 or later"
# endif

So I think either we’d want to raise the minimum VS (I haven’t tested 2017, but I do know 2019 works) or implement a temporary work-around? There’s also the possibility I’m messing something up, so of course would be good if someone else could do a sanity check?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 25 (5 by maintainers)

Commits related to this issue

Most upvoted comments

I can also confirm this built for me. Thanks Larry!

YES! #2622 works without any issues. Thank you!