http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56646
Bug #: 56646 Summary: ICE: in cp_parser_late_return_type_opt, at cp/parser.c:16970 Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcc AssignedTo: unassig...@gcc.gnu.org ReportedBy: pram...@room77.com Created attachment 29686 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29686 Preprocessed source Return type resolution fails for functions inside a struct declared inside other class Methods. Tested on both g++4.7 (Debian 4.7.2-4) and g++ Snapshot (4.8.0 20130316) $ /usr/lib/gcc-snapshot/bin/g++ -v -save-temps -Wall -Wextra -std=gnu++0x abc.cc Using built-in specs. COLLECT_GCC=/usr/lib/gcc-snapshot/bin/g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/4.8.0/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 20130316-1' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++ --prefix=/usr/lib/gcc-snapshot --enable-shared --enable-linker-build-id --disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-snap-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-snap-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-snap-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64 --with-multilib-list=m32,m64 --with-tune=generic --disable-werror --enable-checking=yes --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.8.0 20130316 (experimental) [trunk revision 196694] (Debian 20130316-1) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-std=gnu++11' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/4.8.0/cc1plus -E -quiet -v -imultilib . -imultiarch x86_64-linux-gnu -D_GNU_SOURCE abc.cc -mtune=generic -march=x86-64 -std=gnu++11 -Wall -Wextra -fpch-preprocess -o abc.ii ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/../../../../x86_64-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/../../../../include/c++/4.8.0 /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/../../../../include/c++/4.8.0/x86_64-linux-gnu/. /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/../../../../include/c++/4.8.0/backward /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/include /usr/local/include /usr/lib/gcc-snapshot/lib/gcc/x86_64-linux-gnu/4.8.0/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-Wextra' '-std=gnu++11' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/4.8.0/cc1plus -fpreprocessed abc.ii -quiet -dumpbase abc.cc -mtune=generic -march=x86-64 -auxbase abc -Wall -Wextra -std=gnu++11 -version -o abc.s GNU C++ (Debian 20130316-1) version 4.8.0 20130316 (experimental) [trunk revision 196694] (x86_64-linux-gnu) compiled by GNU C version 4.8.0 20130316 (experimental) [trunk revision 196694], GMP version 5.0.5, MPFR version 3.1.1-p2, MPC version 0.9 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C++ (Debian 20130316-1) version 4.8.0 20130316 (experimental) [trunk revision 196694] (x86_64-linux-gnu) compiled by GNU C version 4.8.0 20130316 (experimental) [trunk revision 196694], GMP version 5.0.5, MPFR version 3.1.1-p2, MPC version 0.9 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 179a73a5a5f01088a1db5a487424c1fe abc.cc: In member function 'void Foo::Func()': abc.cc:23:16: internal compiler error: in cp_parser_late_return_type_opt, at cp/parser.c:16970 auto Bar() -> int { ^ Please submit a full bug report, with preprocessed source if appropriate. See <file:///usr/share/doc/gcc-snapshot/README.Bugs> for instructions. Preprocessed source stored into /tmp/cc1Bz05T.out file, please attach this to your bugreport. ------------------------------------------------------- Source Code: ------------------------------------------------------- void Func() { struct StructDeclaredInsideFunc { // This is OK. auto Bar() -> int { return 1; } }; } class Foo { public: void Func(); }; void Foo::Func() { struct StructDeclaredInsideClassFunc { // Causes: // g++4.7 (Debian 4.7.2-4): internal compiler error: in cp_parser_late_return_type_opt, at // cp/parser.c:16698 // g++ Snapshot (4.8.0 20130316): internal compiler error: in cp_parser_late_return_type_opt, at // cp/parser.c:16970 auto Bar() -> int { return 1; } }; } -------------------------------------------------------