public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tower120 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/61636] generic lambda  "cannot call member function without object"
Date: Sat, 28 Jun 2014 13:17:00 -0000	[thread overview]
Message-ID: <bug-61636-4-az5XfQh0nx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-61636-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636

--- Comment #3 from tower120 <tower120 at gmail dot com> ---
I found that as only I pass *this as parameter and then call functions from it,
it works ok. But it have to be auto:

        /// This work
        std::cout << if_else(do_first,
            *this,
            [&](auto self){ return self.fn1(data); },
            [&](auto self){ return self.fn2(data); }
        ) << '\n';


        /// This not
        std::cout << if_else(do_first,
            *this,
            [&](Test self){ return self.fn1(data); },
            [&](Test self){ return self.fn2(data); }
        ) << '\n';

http://coliru.stacked-crooked.com/a/272a5e0b8089a5c4

And what even more strange, it work if only one lambda is auto:

        std::cout << if_else(do_first,
            *this,
            [&](auto self){ return self.fn1(data); },
            [&](Test self){ return self.fn2(data); }          // ???
        ) << '\n';

http://coliru.stacked-crooked.com/a/ed45a402a6c11d63


  parent reply	other threads:[~2014-06-28 13:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-28  8:13 [Bug c++/61636] New: " tower120 at gmail dot com
2014-06-28  8:22 ` [Bug c++/61636] " tower120 at gmail dot com
2014-06-28  8:55 ` paolo.carlini at oracle dot com
2014-06-28 13:17 ` tower120 at gmail dot com [this message]
2014-07-06 19:58 ` abutcher at gcc dot gnu.org
2014-07-06 20:15 ` abutcher at gcc dot gnu.org
2014-07-06 20:39 ` abutcher at gcc dot gnu.org
2014-07-07  7:08 ` abutcher at gcc dot gnu.org
2014-07-07  7:15 ` abutcher at gcc dot gnu.org
2014-07-26  7:10 ` contact at jeaye dot com
2015-03-09 23:58 ` abutcher at gcc dot gnu.org
2015-03-10  0:37 ` abutcher at gcc dot gnu.org
2015-07-06 12:15 ` trippels at gcc dot gnu.org
2015-10-13 11:28 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-61636-4-az5XfQh0nx@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).