public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/42593] [c++0x] [4.5 Regression] std::bind not assignable to std::function
Date: Sun, 03 Jan 2010 17:57:00 -0000	[thread overview]
Message-ID: <20100103175729.26006.qmail@sourceware.org> (raw)
In-Reply-To: <bug-42593-3237@http.gcc.gnu.org/bugzilla/>



------- Comment #8 from redi at gcc dot gnu dot org  2010-01-03 17:57 -------
Created an attachment (id=19453)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19453&action=view)
preliminary patch

I'm testing this, which is not ready for checkin, but updates std::bind to
handle rvalues and fixes this bug.

As well as fixing the affected testcases (done but not included in this patch)
and fixing the formatting, the decaying behaviour from the resolution to LWG
817 needs to be implemented:
http://home.roadrunner.com/~hinnant/issue_review/lwg-active.html#817

I *think* the patch is correct, but testsuite/30_threads/call_once/39909.cc
fails due to a front-end bug:
/home/redi/src/gcc/build/x86_64-unknown-linux-gnu/libstdc++-v3/include/functional:1179:67:
sorry, unimplemented: unable to determine the declared type of expression
'declval<std::reference_wrapper<Inc> >()()'

A workaround for this is to change call_once to use bind<void>() instead of
bind() i.e.
Index: include/std/mutex
===================================================================
--- include/std/mutex   (revision 155587)
+++ include/std/mutex   (working copy)
@@ -722,12 +722,12 @@ namespace std
     call_once(once_flag& __once, _Callable __f, _Args&&... __args)
     {
 #ifdef _GLIBCXX_HAVE_TLS
-      auto __bound_functor = std::bind(__f, __args...);
+      auto __bound_functor = std::bind<void>(__f, __args...),
       __once_callable = &__bound_functor;
       __once_call = &__once_call_impl<decltype(__bound_functor)>;
 #else
       unique_lock<mutex> __functor_lock(__get_once_mutex());
-      __once_functor = std::bind(__f, __args...);
+      __once_functor = std::bind<void>(__f, __args...);
       __set_once_functor_lock_ptr(&__functor_lock);
 #endif

(the ability to use this workaround was the main reason I fixed std::bind<void>
recently)


-- 


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


  parent reply	other threads:[~2010-01-03 17:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-03 12:37 [Bug libstdc++/42593] New: [c++0x] " d dot frey at gmx dot de
2010-01-03 12:47 ` [Bug libstdc++/42593] [c++0x] [4.5 Regression] " paolo dot carlini at oracle dot com
2010-01-03 14:13 ` redi at gcc dot gnu dot org
2010-01-03 14:26 ` paolo dot carlini at oracle dot com
2010-01-03 15:07 ` redi at gcc dot gnu dot org
2010-01-03 15:11 ` paolo dot carlini at oracle dot com
2010-01-03 16:03 ` paolo dot carlini at oracle dot com
2010-01-03 16:28 ` redi at gcc dot gnu dot org
2010-01-03 16:34 ` paolo dot carlini at oracle dot com
2010-01-03 17:57 ` redi at gcc dot gnu dot org [this message]
2010-01-03 18:05 ` paolo dot carlini at oracle dot com
2010-01-03 18:07 ` redi at gcc dot gnu dot org
2010-01-03 20:58 ` paolo dot carlini at oracle dot com
2010-01-03 21:03 ` paolo dot carlini at oracle dot com
2010-01-03 22:10 ` redi at gcc dot gnu dot org
2010-01-04 10:30 ` paolo dot carlini at oracle dot com
2010-01-10 13:46 ` paolo dot carlini at oracle dot com
2010-01-10 16:26 ` redi at gcc dot gnu dot org
2010-01-12  0:54 ` redi at gcc dot gnu dot org
2010-01-12  0:55 ` redi at gcc dot gnu dot 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=20100103175729.26006.qmail@sourceware.org \
    --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).