https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103443
Bug ID: 103443 Summary: consteval function rejected as constant expression Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vincent.hamp at higaski dot at Target Milestone: --- Not really sure whether that's a frontend or a libstdc++ bug, but GCC 11.1.0 (and according to godbolt trunk as well) does not accept the following snippet. #include <cstdint> #include <cstdio> #include <utility> // #define QUALIFIER constexpr // compiles #define QUALIFIER consteval // does not compile template <size_t... Is> QUALIFIER uint32_t index_sequence2mask(std::index_sequence<Is...>) { if constexpr (sizeof...(Is) == 0u) return 0u; else return ((1u << Is) | ...); } template <uint32_t Mask = index_sequence2mask(std::make_index_sequence<1u>{})> void use_mask() { printf("%s\n", __PRETTY_FUNCTION__); } int main() { use_mask(); } The code is rejected with the following error: "expression 'std::make_index_sequence<1>{}' is not a constant expression"