with 2.2.5, it just depends on virtual/opencl, why 2.4.0 depends on clang-4? I tried to build with clang-5, and there is no issue so far. So anyone can explain this?
https://github.com/gentoo/gentoo/blob/5cbe6607217626e40457960d14f7a4d1f14ebd0c/media-gfx/darktable/darktable-2.4.0.ebuild#L56-L60 ^ that is wrong. clang is *only* used for test-compiling opencl kernels during build time. it does not and will not help during runtime. you probably should just disable that kernel test-compilation via -DTESTBUILD_OPENCL_PROGRAMS:BOOL=OFF cmake flag.
Moved clang/llvm to DEPEND (build time only) and also allow to use version 5. https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7fa7f4aeddd82a70ba9446add9f88c7ed8327a16