public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51494] New: Legal program rejection - capturing "this" when using static method inside lambda
@ 2011-12-10  8:32 ulidtko at gmail dot com
  2011-12-22  1:39 ` [Bug c++/51494] " paolo.carlini at oracle dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: ulidtko at gmail dot com @ 2011-12-10  8:32 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51494
           Summary: Legal program rejection - capturing "this" when using
                    static method inside lambda
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ulidtko@gmail.com


Consider the following source code:

struct A
{
    static void f() {}

    void foo()
    {
        [] () { f(); };
    }
};


GCC 4.6.1 produces the following error message when compiling it:
test.cpp: In lambda function:
test.cpp:7:27: error: ‘this’ was not captured for this lambda function

However, the member function f is static and it's call doesn't use 'this';
therefore the lambda need not to capture 'this'. The code shall compile.


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

end of thread, other threads:[~2013-03-08 16:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-10  8:32 [Bug c++/51494] New: Legal program rejection - capturing "this" when using static method inside lambda ulidtko at gmail dot com
2011-12-22  1:39 ` [Bug c++/51494] " paolo.carlini at oracle dot com
2012-05-03 21:53 ` luto at mit dot edu
2012-05-03 23:05 ` paolo.carlini at oracle dot com
2012-06-04  8:22 ` gcc-bugx at mailinator dot com
2012-06-04 19:35 ` jason at gcc dot gnu.org
2012-08-16  9:54 ` paolo.carlini at oracle dot com
2012-12-07 15:18 ` kpx1894 at gmail dot com
2013-03-04 18:16 ` jason at gcc dot gnu.org
2013-03-05 17:47 ` jason at gcc dot gnu.org
2013-03-08 16:04 ` jason at gcc dot gnu.org
2013-03-08 16:12 ` 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).