$ cat y.cpp template <class> struct foo { public: void bar() { [this]{bar();}(); } }; int main() { foo<int> ss; ss.bar(); } $ g++ -v -save-temps -std=c++11 y.cpp Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /build/src/gcc-4.7-20120721/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id --with-ppl --enable-cloog-backend=isl --disable-ppl-version-check --disable-cloog-version-check --enable-lto --enable-gold --enable-ld=default --enable-plugin --with-plugin-ld=ld.gold --with-linker-hash-style=gnu --enable-multilib --disable-libssp --disable-build-with-cxx --disable-build-poststage1-with-cxx --enable-checking=release Thread model: posix gcc version 4.7.1 20120721 (prerelease) (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/cc1plus -E -quiet -v -D_GNU_SOURCE y.cpp -mtune=generic -march=x86-64 -std=c++11 -fpch-preprocess -o y.ii ignoring nonexistent directory "/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1 /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/x86_64-unknown-linux-gnu /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../include/c++/4.7.1/backward /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/include /usr/local/include /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/cc1plus -fpreprocessed y.ii -quiet -dumpbase y.cpp -mtune=generic -march=x86-64 -auxbase y -std=c++11 -version -o y.s GNU C++ (GCC) version 4.7.1 20120721 (prerelease) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.7.1 20120721 (prerelease), GMP version 5.0.5, MPFR version 3.1.1, MPC version 1.0 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C++ (GCC) version 4.7.1 20120721 (prerelease) (x86_64-unknown-linux-gnu) compiled by GNU C version 4.7.1 20120721 (prerelease), GMP version 5.0.5, MPFR version 3.1.1, MPC version 1.0 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: 8466381cd327359656bc3ec3a9c33398 y.cpp: In lambda function: y.cpp:15:1: internal compiler error: in get_expr_operands, at tree-ssa-operands.c:1035 Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.archlinux.org/> for instructions. $ cat y.ii # 1 "y.cpp" # 1 "<command-line>" # 1 "y.cpp" template <class> struct foo { public: void bar() { [this]{bar();}(); } }; int main() { foo<int> ss; ss.bar(); } Gcc doesn't crash if foo is not a templated class.
Gcc also doesn't crash if the lambda line is changed to [this]{this->bar();}(); Although the resulting program does.
Confirmed.
*** Bug 55156 has been marked as a duplicate of this bug. ***
(In reply to comment #1) > Gcc also doesn't crash if the lambda line is changed to > > [this]{this->bar();}(); > > Although the resulting program does. Of course, resulting program should crash because you have infinite reccursion call. Anyway next code crashes too: #include <iostream> template <class> struct foo { public: void blah() { std::cerr<<"blah-blah"<<std::endl; } void bar() { [this]{blah();}(); } }; int main() { foo<int> ss; ss.bar(); } For workaround with [this] thanks, i should guess...
unhandled expression in get_expr_operands(): <field_decl 0x59f6a18 __this type <pointer_type 0x5a01a80 type <record_type 0x5a017e0 A sizes-gimplified type_5 type_6 QI size <integer_cst 0x58acf80 constant 8> unit size <integer_cst 0x58acfa0 constant 1> align 8 symtab 0 alias set -1 canonical type 0x5a017e0 fields <type_decl 0x5a03450 A> context <translation_unit_decl 0x58c5170 D.1> full-name "struct A<int>" X() X(constX&) this=(X&) n_parents=0 use_template=1 interface-unknown pointer_to_this <pointer_type 0x5a01930> chain <type_decl 0x5a032e0 A>> readonly sizes-gimplified unsigned DI size <integer_cst 0x58acdc0 constant 64> unit size <integer_cst 0x58acde0 constant 8> align 64 symtab 0 alias set -1 canonical type 0x5a01a80> readonly used unsigned nonlocal decl_7 DI file test.ii line 6 col 6 size <integer_cst 0x58acdc0 64> unit size <integer_cst 0x58acde0 8> align 64 offset_align 128 offset <integer_cst 0x58ace00 type <integer_type 0x58c7000 sizetype> constant 0> bit offset <integer_cst 0x58ace80 type <integer_type 0x58c70a8 bitsizetype> constant 0> context <record_type 0x5a01dc8 __lambda0> chain <type_decl 0x5a037e8 __lambda0>>
Dup of Bug 53697 and Bug 53137.
Dup. *** This bug has been marked as a duplicate of bug 53137 ***