https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89197
Bug ID: 89197 Summary: Templated Functions const auto assignment causes internal compiler error Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: cchancey at comconcepts dot com Target Milestone: --- Created attachment 45601 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45601&action=edit precompoiled .i as mentioned in bug reporting guide GCC Version: gcc version 8.2.0 System: x86_64-linux-gnu Configured with: ./configure --disable-multilib Command given: gcc -v main.cpp Error Message: main.cpp: In function ‘uint32_t foo_fails(const std::bitset<_Nb>&, int, int)’: main.cpp:23:57: internal compiler error: in split_nonconstant_init_1, at cp/typeck2.c:723 const auto start_reverse_index=int {start_bit+length-1}; How to replicate: Compile code below. #include <bitset> #include <cmath> //works uint32_t foo_works_non_templated(const int start, const int length) { const auto start_reverse_index=int {start+length-1}; const auto end_reverse_index=int {start-1}; return 0; } //works template <size_t N> uint32_t foo_works(const std::bitset<N>& bits, const int start_bit, const int length) { const int start_reverse_index {start_bit+length-1}; const int end_reverse_index {start_bit-1}; return 0; } //min example size_t template <size_t N> uint32_t foo_fails(const std::bitset<N>& bits, const int start_bit, const int length) { const auto start_reverse_index=int {start_bit+length-1}; const auto end_reverse_index=int {start_bit-1}; return 0; } //min example not using std::bitset template <int n> uint32_t foo_fails(const int start, const int length) { const auto start_reverse_index=int {start+length-1}; const auto end_reverse_index=int {start-1}; return 0; }