[Bug c++/89197] New: Templated Functions const auto assignment causes internal compiler error

2019-02-04 Thread cchancey at comconcepts dot com
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 
#include 

//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 
uint32_t foo_works(const std::bitset& 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 
uint32_t foo_fails(const std::bitset& 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 
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;
}

[Bug c++/89197] Templated Functions const auto assignment causes internal compiler error

2019-02-04 Thread cchancey at comconcepts dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89197

--- Comment #1 from Cameron  ---
The foo_fails functions is where the error can be observed. The working
functions are to show behavior with non-templated, and non-deduced types
respectively.

[Bug c++/89197] Templated Functions const auto assignment causes internal compiler error

2019-02-04 Thread cchancey at comconcepts dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89197

--- Comment #2 from Cameron  ---
Behavior is also similar on 8.1.
All functions build on gcc 7.4.

According to the online compilation found here:
 https://godbolt.org/z/MJkd-8