static_assert(llvm::is_sorted_constexpr(...)) fails with std::initializer_list
Describe the bug
When using static_assert(llvm::is_sorted_constexpr(SupportedOp)) where SupportedOp is a constexpr static std::initializer_list<unsigned>, compilation fails with:
error: static_assert expression is not an integral constant expression
This happens when I run cmake --build . --target check-mlir, and my cmake command is
cmake -G Ninja ../llvm -DLLVM_ENABLE_PROJECTS=mlir -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_TARGETS_TO_BUILD="host;NVPTX" -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DLLVM_ENABLE_LLD=ON -DLLVM_CCACHE_BUILD=ON -DMLIR_INCLUDE_INTEGRATION_TESTS=ON -DLLVM_USE_SPLIT_DWARF=ON
Replacing std::initializer_list with std::array works as expected.
Is this an existing issue? Or anyone also encountered this problem?
Can you come up with a standalone reproducer?
@bababuck
@Rayfxl which version of clang are you using? (/usr/bin/clang++ --version)
I suspect that the error is related to an older clang version being used to compile, but cannot confirm without knowing what version was used.