http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51494
gcc-bugx at mailinator dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gcc-bugx at mailinator dot | |com --- Comment #4 from gcc-bugx at mailinator dot com 2012-06-04 08:21:54 UTC --- Probably related error: this capture ignored on explicit instantiation. --------------------8<--------------- struct A { static void f() {} template <typename T> void foo() { [this] () { f(); }; } }; template void A::foo<int>(); -------------------->8--------------- Compiler version & output: $ g++ -std=c++11 -c -v y.cc Using built-in specs. COLLECT_GCC=g++ Target: x86_64-unknown-linux-gnu Configured with: ./configure --enable-languages=c,c++ --prefix=/home/x Thread model: posix gcc version 4.7.0 (GCC) COLLECT_GCC_OPTIONS='-std=c++11' '-c' '-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /home/x/libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/cc1plus -quiet -v -D_GNU_SOURCE y.cc -quiet -dumpbase y.cc -mtune=generic -march=x86-64 -auxbase y -std=c++11 -version -o /tmp/ccdFvfri.s GNU C++ (GCC) version 4.7.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.7.0, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/home/x/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /home/x/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0 /home/x/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/x86_64-unknown-linux-gnu /home/x/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/backward /home/x/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include /usr/local/include /home/x/include /home/x/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/include-fixed /usr/include End of search list. GNU C++ (GCC) version 4.7.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 4.7.0, GMP version 4.3.2, MPFR version 3.0.0-p8, MPC version 0.9 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: ... y.cc: In instantiation of ‘A::foo() [with T = int]::<lambda()>’: y.cc:8:4: required from ‘struct A::foo() [with T = int]::<lambda()>’ y.cc:8:3: required from ‘void A::foo() [with T = int]’ y.cc:11:27: required from here y.cc:8:17: error: ‘this’ was not captured for this lambda function