public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49554] New: [4.7 Regression] [C++0x] lambda capture causes "cannot call member function ... without object"
@ 2011-06-27 23:26 redi at gcc dot gnu.org
  2011-06-27 23:27 ` [Bug c++/49554] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2011-06-27 23:26 UTC (permalink / raw)
  To: gcc-bugs

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++


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-06-29 17:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-27 23:26 [Bug c++/49554] New: [4.7 Regression] [C++0x] lambda capture causes "cannot call member function ... without object" redi at gcc dot gnu.org
2011-06-27 23:27 ` [Bug c++/49554] " redi at gcc dot gnu.org
2011-06-27 23:44 ` redi at gcc dot gnu.org
2011-06-29 15:57 ` jason at gcc dot gnu.org
2011-06-29 17:15 ` jason at gcc dot gnu.org
2011-06-29 17:27 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).