https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91867
Bug ID: 91867
Summary: Internal compiler error in simple for(auto) loop when
using -std=c++11 with -fconcepts
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: nwentzell at flatironinstitute dot org
Target Milestone: ---
I am using gcc-trunk (2805977f6719d7a487424dd2ded0b5d000cc5081)
configured with
-----------------------------------
./configure -v \
--prefix=$INSTALL_DIR \
--enable-shared \
--enable-languages=c,c++,fortran \
--with-system-zlib \
--enable-thread \
--disable-multilib \
--enable-checking=release \
--enable-lto \
----------------------------------
The following minimal code snippet
------------------------main.cpp--
#include <string>
std::string s = "format";
int main(){
for (auto const* flag : {&s}){}
}
---------------------------------
fails to compile in c++11 mode with concepts enabled:
$ g++ -fconcepts -std=c++11 main.cpp
-----------------------------------
source>: In function 'int main()':
<source>:6:32: internal compiler error: in type_unification_real, at
cp/pt.c:20870
6 | for (auto const* flag : {&s}){}
|
----------------------------------
The failure can be reproduced on godbolt.org (https://godbolt.org/z/YP-ACk)