This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/47169] New: cannot deduce base class functions from a lambda
- From: "internet at 123gen dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 4 Jan 2011 16:00:38 +0000
- Subject: [Bug c++/47169] New: cannot deduce base class functions from a lambda
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47169
Summary: cannot deduce base class functions from a lambda
Product: gcc
Version: 4.5.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: internet@123gen.com
Created attachment 22899
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22899
test case
hi,
when capturing "this" in a lambda, i can correctly call functions of the
captured class from inside the lambda; but i can't call functions of base
classes of the captured class from inside the lambda.
i am attaching a test case to show the problem. lambda2 calls a function of
Derived (the captured class) and that works fine. however, lambda1 calls a
function of a base class of Derived, which GCC can't seem to resolve:
test.cpp: In lambda function:
test.cpp:13:6: error: cannot call member function 'void Base::f()' without
object
by explicitly adding "this->" before the call to f(), lambda1 then compiles
fine.
i am testing this with GCC 4.5.2 on Win. this is similar to bug #46047, except
that the test case in that bug report works for me. this case is therefore
slightly different.
note that i don't know of the validity of calling a base class function without
adding "this->", but i'd think it should be resolved by the compiler just like
any base member function call made outside of a lambda. note also that the
Microsoft compiler swallows this test case just fine.
Zouzou