http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51490
Bug #: 51490 Summary: [c++11] push_class_level_binding internal error on class scoping within a lambda expression Classification: Unclassified Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: stormblazeral...@gmail.com Created attachment 26038 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26038 Preprocessed source output gcc version 4.6.1 20110908 (Red Hat 4.6.1-9) (GCC) See below example code. Compiled with g++ -std=c++0x #include <vector> #include <algorithm> using namespace std; template <typename Key> class Foo{ public: Key methodA(Key x, Key y){ return x+y; } void methodB(){ vector<Key> bar = { 0, 1, 2, 3, 4, 5 }; Key sum = 0; //Calling Foo::methodA causes the compiler to report an internal error for_each( bar.begin(), bar.end(), [&](Key a){ sum = Foo::methodA(sum, a); }); } }; int main(){ Foo<int> thing; thing.methodB(); }