This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51490] New: [c++11] push_class_level_binding internal error on class scoping within a lambda expression
- From: "stormblazeralpha at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 09 Dec 2011 23:40:51 +0000
- Subject: [Bug c++/51490] New: [c++11] push_class_level_binding internal error on class scoping within a lambda expression
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: stormblazeralpha@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();
}