https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71197
Bug ID: 71197 Summary: for range loop causes an error with inline function references Product: gcc Version: 6.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jaked122 at gmail dot com Target Milestone: --- Attempting to build a game causes an error as so: > src/cata_tiles.cpp:972:54: internal compiler error: in add_expr, at > tree.c:7870 > &cata_tiles::draw_critter_at } ) { However, trying to compile the preprocessed source file yields this: >g++: internal compiler error: Segmentation fault (program cc1plus) I have to guess that they are probably related. Changing the code so that this > for( auto f : { &cata_tiles::draw_furniture, &cata_tiles::draw_trap, > &cata_tiles::draw_field_or_item, > &cata_tiles::draw_vpart, > &cata_tiles::draw_vpart_below, > &cata_tiles::draw_terrain_below, > &cata_tiles::draw_critter_at } ) becomes this > const decltype( &cata_tiles::draw_furniture ) drawing_layers[] = { > &cata_tiles::draw_furniture, > &cata_tiles::draw_trap, > &cata_tiles::draw_field_or_item, > &cata_tiles::draw_vpart, > &cata_tiles::draw_vpart_below, > &cata_tiles::draw_terrain_below, > &cata_tiles::draw_critter_at > }; > for(auto f : drawing_layers) does not cause a crash. If it is helpful to know the context of the code, (how the drawing layers will be used), they are function pointers that are called like so > (this->*f)(<function arguments>); Anyway, I'm not terribly sure that I've reported this right, though I did read the guidelines for bug reports, so I'd welcome any corrections that need to be made. Thank you.