https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69323
Bug ID: 69323 Summary: Segmentation fault when instantiating class template with inner class which declares itself as a friend Product: gcc Version: 4.6.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: bd at jollyrogerlabs dot com Target Milestone: --- Created attachment 37379 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37379&action=edit Preprocessed file, generated by adding "-save-temps" immediately after "g++" on the command line. Playing around with some template tricks (thus the filename) and produced a segmentation fault. Additionally, the error was generated from a program that was very similar to one already working correctly, to which I attempted to have an inner class of a class template (actually struct in both cases but whatever) make a static member function private and then declare itself as its own friend. So in addition to the preprocessed source generated with -save-temps, I will attach the original source file with instructions on how to switch the error on and off. Finally, I will report this on Ubuntu launchpad as well and reference this upstream bug ID in case this turns out to be some issue in how they are packaging for release. GCC version: $ g++ --version g++ (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) 4.6.4 System type: Ubuntu 12.04 LTS 64 bit $ uname -a Linux apocalypse-ranch-office 3.5.0-54-generic #81~precise1-Ubuntu SMP Tue Jul 15 04:02:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux $ cat /etc/debian_version wheezy/sid Compiler command line plus output: $ g++ -Wall -std=c++0x -g -O0 -o /tmp/stupid_template_tricks /tmp/stupid_template_tricks.cpp /tmp/stupid_template_tricks.cpp: In instantiation of ‘Outer<42>::StupidValueTrick’: /tmp/stupid_template_tricks.cpp:62:13: instantiated from here /tmp/stupid_template_tricks.cpp:13:3: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions. Preprocessed source stored into /tmp/ccO1MHdE.out file, please attach this to your bugreport.