Fix compile error for Xcode 9

The older Xcode 9 compiler has troubles with ArrayHandleDecorator that
are similar to those of earlier Microsoft and Cuda compilers.

Note that the logic behind the changed compiler check has a lot of
guesswork involved. I noticed this problem on a laptop with Xcode 9
installed. However, even though Xcode uses the clang compiler, it
notoriously does not return the actual clang version. Instead, it
returns some toolchain version that has nothing to do with it. I'm
pretty sure Xcode 9 is using clang version 4 under the covers, but
__clang_major__ reports 9. Oddly, Xcode 10 reports __clang_major__ as 8,
so that's not too much help. So instead, we check for
__apple_build_version__, which returns the Xcode version (sort of) and
that seems a reasonable comparison.

Although I have not tried it, I'm willing to bet that the older clang
outside of Xcode will also have issues. Here is where the real guesswork
takes place since I don't have handy compilers to try. Like I said, I
think the internet claims that Xcode 9 is using clang 4, so also add to
the check any compiler that reports itself clang 4 or below.
This commit is contained in:
Kenneth Moreland 2019-10-04 11:32:07 -06:00
parent ff23ab8305
commit c0744dbb49

@ -26,8 +26,10 @@
#include <type_traits>
#include <utility>
// MSVC < 2019 and CUDA have issues with tao integer sequences
#if (defined(VTKM_MSVC) && (_MSC_VER < 1920)) || defined(VTKM_CUDA_DEVICE_PASS)
// MSVC < 2019 and CUDA and Xcode < 10 and Clang < 5 have issues with tao integer sequences
#if (defined(VTKM_MSVC) && (_MSC_VER < 1920)) || defined(VTKM_CUDA_DEVICE_PASS) || \
(defined(__apple_build_version__) && (__apple_build_version__ < 10000000)) || \
(defined(VTKM_CLANG) && (__clang_major__ < 5))
#define VTKM_USE_BRIGAND_SEQ
#endif