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.