https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68451
Bug ID: 68451 Summary: internal compiler error: Segmentation fault when using decltype with friend inside a class template Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tim.pavlic at minelab dot com.au Target Milestone: --- Source to reproduce: ---- struct A {}; struct B { A a; friend decltype(a); // This works, B is not a class template }; template <typename T> struct C { A a; // This friend declaration gives an ICE. // Seemingly because C is a class template friend decltype(a); }; int main() { B b; C<int> c; // This causes the ICE } ---- I have the above source in a single file, ice.cpp, and compile with: g++ -std=c++14 ice.cpp Looks like using decltype in conjunction with friend has problems when you are in a class template. It also crashes on GCC 5 (not sure of minor number). -std=c++11 has the same issue.