public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46048] New: lambda: access to a member function
@ 2010-10-16 15:01 mikhail_semenov at hotmail dot com
  2010-10-16 15:03 ` [Bug c++/46048] " mikhail_semenov at hotmail dot com
  2010-10-16 15:26 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: mikhail_semenov at hotmail dot com @ 2010-10-16 15:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46048

           Summary: lambda: access to a member function
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mikhail_semenov@hotmail.com


In GCC 4.5.0 the follwing class fails to compile. In C++0x draft n3126, the
member variable 'f' does not require 'this->'. Surely the same should apply to
a member function.

struct S10 
{
    int f;
    double p;
        void inc(int& a) { a += f;}
    void work(int n) 
    {
        int m = n*n;
        int j = 40;
        f = 10;
        p =3.7;
        auto m3 = [this,&n]() mutable -> int
        {
            p++;
            f++;       
                        this->inc(n); //required                
            return n;
        };
        cout << "S9 m3():" << m3() << endl;
        cout << "f:" << f << " p:" << p << " n:" << n << endl;
    }
};


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

* [Bug c++/46048] lambda: access to a member function
  2010-10-16 15:01 [Bug c++/46048] New: lambda: access to a member function mikhail_semenov at hotmail dot com
@ 2010-10-16 15:03 ` mikhail_semenov at hotmail dot com
  2010-10-16 15:26 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mikhail_semenov at hotmail dot com @ 2010-10-16 15:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46048

--- Comment #1 from Mikhail Semenov <mikhail_semenov at hotmail dot com> 2010-10-16 15:03:36 UTC ---
The code fails to compile is "this->inc(n);" is replaced with "inc(n);"


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

* [Bug c++/46048] lambda: access to a member function
  2010-10-16 15:01 [Bug c++/46048] New: lambda: access to a member function mikhail_semenov at hotmail dot com
  2010-10-16 15:03 ` [Bug c++/46048] " mikhail_semenov at hotmail dot com
@ 2010-10-16 15:26 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2010-10-16 15:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46048

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-16 15:26:28 UTC ---
dup

*** This bug has been marked as a duplicate of bug 46047 ***


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

end of thread, other threads:[~2010-10-16 15:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-16 15:01 [Bug c++/46048] New: lambda: access to a member function mikhail_semenov at hotmail dot com
2010-10-16 15:03 ` [Bug c++/46048] " mikhail_semenov at hotmail dot com
2010-10-16 15:26 ` redi 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).