https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87152
Bug ID: 87152 Summary: internal compiler error: in tsubst_copy, at cp/pt.c:15484 Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tiagomacarios at gmail dot com Target Milestone: --- https://godbolt.org/z/RnO6a- #include <array> #include <cmath> #include <iostream> template<bool ... bits> constexpr int int_from_bits() { constexpr auto a = std::array{bits...}; int sum = 0; for (int index = 0; bool const b : a) { sum += b ? exp2(index) : 0; } return sum; } int j = int_from_bits<false,false,true>(); <source>: In instantiation of 'constexpr int int_from_bits() [with bool ...bits = {false, false, true}]': <source>:19:40: required from here <source>:13:25: internal compiler error: in tsubst_copy, at cp/pt.c:15486 13 | sum += b ? exp2(index) : 0; | ^~~~~ Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1