https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80856
Bug ID: 80856 Summary: ICE from template local overload resolution Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: joshkel at gmail dot com Target Milestone: --- Created attachment 41402 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41402&action=edit Test case Compiling the attached source file with no flags ("g++-7 EngineReportWriter.cpp") results in an internal compiler error: EngineReportWriter.cpp: In function ‘T WrapToCycle(T) [with T = int]’: EngineReportWriter.cpp:2:10: internal compiler error: Segmentation fault inline T WrapToCycle(T degrees) ^~~~~~~~~~~ 0x86f4b4a crash_signal ../../src/gcc/toplev.c:337 0x84d576b useless_type_conversion_p(tree_node*, tree_node*) ../../src/gcc/gimple-expr.c:85 0x83b4b8f types_compatible_p ../../src/gcc/gimple-expr.h:66 0x83b4b8f gimple_check_call_args ../../src/gcc/cgraph.c:3733 0x83b4b8f gimple_check_call_matching_types(gimple*, tree_node*, bool) ../../src/gcc/cgraph.c:3783 0x83b6304 symbol_table::create_edge(cgraph_node*, cgraph_node*, gcall*, long long, int, bool) ../../src/gcc/cgraph.c:864 0x83b6529 cgraph_node::create_edge(cgraph_node*, gcall*, long long, int) ../../src/gcc/cgraph.c:900 0x83bbb06 execute ../../src/gcc/cgraphbuild.c:337 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions. The bug appears to be triggered by the combination of a template plus local function declarations plus overload resolution. If I move the local scope function declarations to global scope, or if I change the function declarations so that overload resolution isn't necessary, then the bug goes away. This is on Ubuntu 14.04 x86, running GCC 7.1.0 from the Ubuntu Toolchain Test PPA (https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test). Previous versions of GCC (including GCC 6.3.0 from the Ubuntu Toolchain Test PPA) are unaffected. GCC 7.1 on godbolt.org is also reporting errors: https://godbolt.org/g/eAYhqd