https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91465
Bug ID: 91465 Summary: unexpected expression of kind overload (ICE) Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: cuzdav at gmail dot com Target Milestone: --- This code results in an ICE: In member function 'Destination Bar<T>::baz(Source)': internal compiler error: unexpected expression 'foo' of kind overload return Destination{foo(aLowValue)}; ^ // See it LIVE! https://godbolt.org/z/42c_Ll enum class Destination {}; enum class Source {}; Destination foo(Source value) { return Destination{}; } Destination foo(double value) { return Destination{}; } template <typename T> struct Bar { Destination baz(Source aLowValue) { return Destination{foo(aLowValue)}; // <<<< HERE } }; Bug appears in 9.1 in c++17 (and up) in all higher g++ versions as well. OK if c++14 or lower, and OK if older g++.