This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49554] New: [4.7 Regression] [C++0x] lambda capture causes "cannot call member function ... without object"
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 27 Jun 2011 23:25:53 +0000
- Subject: [Bug c++/49554] New: [4.7 Regression] [C++0x] lambda capture causes "cannot call member function ... without object"
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49554
Summary: [4.7 Regression] [C++0x] lambda capture causes "cannot
call member function ... without object"
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: redi@gcc.gnu.org
CC: jason@gcc.gnu.org
template<typename T>
struct base
{
struct iterator { };
iterator begin();
};
template<typename T>
class flist : public base<T>
{
typedef base<T> Base;
typedef typename Base::iterator Base_iterator;
public:
void
resize()
{
Base_iterator b = Base::begin();
[b](int i) { return i; };
}
};
void test01()
{
flist<int> fl;
fl.resize();
}
objexpr.ii: In lambda function:
objexpr.ii:22:6: required from âstruct flist<T>::resize() [with T =
int]::<lambda(int)>â
objexpr.ii:22:5: required from âvoid flist<T>::resize() [with T = int]â
objexpr.ii:29:13: required from here
objexpr.ii:20:19: error: cannot call member function âbase<T>::iterator
base<T>::begin() [with T = int]â without object
If 'b' is not captured there's no error
This breaks <debug/forward_list> in libstdc++