AMDiSCXXFeatures.cmake 529 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#include(CheckIncludeFileCXX)
include(CheckCXXSourceCompiles)
#include(CheckCXXSymbolExists)

# fold expressions (a + ...)
check_cxx_source_compiles("
  template <class... Args>
  int f(Args... args)
  {
    return (args + ...);
  }
  int main()
  {
    f(0,1,2,3,4,5);
  }
16
"  AMDIS_HAS_CXX_FOLD_EXPRESSIONS
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
)

check_cxx_source_compiles("
  template <int I>
  auto f()
  {
    if constexpr(I == 0)
      return double{1.0};
    else
      return int{0};
  }
  int main()
  {
    return f<1>();
  }
"  AMDIS_HAS_CXX_CONSTEXPR_IF
)