* [Bug libstdc++/48313] std::bind with template function
2011-03-28 11:58 [Bug libstdc++/48313] New: std::bind with template function joerg.richter@pdv-fs.de
@ 2011-03-28 12:31 ` redi at gcc dot gnu.org
2011-03-28 12:40 ` redi at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-28 12:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48313
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2011.03.28 12:17:25
Ever Confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-28 12:17:25 UTC ---
The example should work. I'm travelling today but will check the <functional>
code later to see why the F&& constructor is being chosen instead of the const
F& one.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/48313] std::bind with template function
2011-03-28 11:58 [Bug libstdc++/48313] New: std::bind with template function joerg.richter@pdv-fs.de
2011-03-28 12:31 ` [Bug libstdc++/48313] " redi at gcc dot gnu.org
@ 2011-03-28 12:40 ` redi at gcc dot gnu.org
2011-03-28 13:09 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-28 12:40 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48313
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-28 12:24:23 UTC ---
The example can be modified to work by passing a pointer, so the template
argument isn't deduced as a function type:
std::bind( &func<int>, 0 );
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/48313] std::bind with template function
2011-03-28 11:58 [Bug libstdc++/48313] New: std::bind with template function joerg.richter@pdv-fs.de
2011-03-28 12:31 ` [Bug libstdc++/48313] " redi at gcc dot gnu.org
2011-03-28 12:40 ` redi at gcc dot gnu.org
@ 2011-03-28 13:09 ` redi at gcc dot gnu.org
2011-03-28 15:15 ` redi at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-28 13:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48313
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-28 12:43:12 UTC ---
It's not the _Bind constructor, it's the bind() call itself, this demonstrates
the problem:
template<typename _Functor, typename... _ArgTypes>
inline
void
bind(_Functor&& __f, _ArgTypes&&... __args) { }
template<class T> void func( T )
{}
int main( int, char** )
{
bind( func<int>, 0 );
}
we might just need to overload std::bind for function types
std::bind() in 4.5 was defined differently as it didn't support rvalues
properly, so didn't show the problem
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/48313] std::bind with template function
2011-03-28 11:58 [Bug libstdc++/48313] New: std::bind with template function joerg.richter@pdv-fs.de
` (2 preceding siblings ...)
2011-03-28 13:09 ` redi at gcc dot gnu.org
@ 2011-03-28 15:15 ` redi at gcc dot gnu.org
2011-03-28 17:09 ` [Bug c++/48313] [C++0] " redi at gcc dot gnu.org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-28 15:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48313
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-28 14:26:35 UTC ---
slightly further reduced:
template<typename Functor, typename ArgTypes>
inline void
bind(Functor&& f, ArgTypes&& a) { }
template<typename T>
void func( T )
{}
int main( int, char** )
{
bind( func<int>, 0 );
}
this is certainly not a libstdc++ bug (std::bind matches the signature require
by the C++0x draft)
I think the parameter is a non-deduced context, because the argument is an
overload set containing one or more function templates ([temp.deduct.call p6)
So I think this is actually invalid and G++ is right to reject it.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/48313] [C++0] std::bind with template function
2011-03-28 11:58 [Bug libstdc++/48313] New: std::bind with template function joerg.richter@pdv-fs.de
` (3 preceding siblings ...)
2011-03-28 15:15 ` redi at gcc dot gnu.org
@ 2011-03-28 17:09 ` redi at gcc dot gnu.org
2011-03-28 20:34 ` [Bug c++/48313] [C++0x] " jason at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-28 17:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48313
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |UNCONFIRMED
CC| |jason at gcc dot gnu.org
Component|libstdc++ |c++
Summary|std::bind with template |[C++0] std::bind with
|function |template function
Ever Confirmed|1 |0
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-28 17:02:14 UTC ---
Actually no, that paragraph doesn't apply because P is a reference type not
function type.
Jason should the call to f(h<int>) be accepted here?
template<typename F>
void f(F&&) { }
void g() { }
template<typename T> void h() { }
int main()
{
f( g ); // OK
void (&p)() = h<int>;
f( p ); // OK
f( h<int> ); // ???
}
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/48313] [C++0x] std::bind with template function
2011-03-28 11:58 [Bug libstdc++/48313] New: std::bind with template function joerg.richter@pdv-fs.de
` (4 preceding siblings ...)
2011-03-28 17:09 ` [Bug c++/48313] [C++0] " redi at gcc dot gnu.org
@ 2011-03-28 20:34 ` jason at gcc dot gnu.org
2011-03-29 4:06 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-28 20:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48313
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed|2011-03-28 12:17:25 |2011.03.28 20:10:59
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-28 20:10:59 UTC ---
Yes, that's a bug.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/48313] [C++0x] std::bind with template function
2011-03-28 11:58 [Bug libstdc++/48313] New: std::bind with template function joerg.richter@pdv-fs.de
` (5 preceding siblings ...)
2011-03-28 20:34 ` [Bug c++/48313] [C++0x] " jason at gcc dot gnu.org
@ 2011-03-29 4:06 ` jason at gcc dot gnu.org
2011-03-29 14:29 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-29 4:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48313
--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-29 00:04:57 UTC ---
Author: jason
Date: Tue Mar 29 00:04:54 2011
New Revision: 171643
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171643
Log:
PR c++/48313
* pt.c (maybe_adjust_types_for_deduction): Handle T&& deduction
from overloaded function.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/rv-deduce2.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/48313] [C++0x] std::bind with template function
2011-03-28 11:58 [Bug libstdc++/48313] New: std::bind with template function joerg.richter@pdv-fs.de
` (6 preceding siblings ...)
2011-03-29 4:06 ` jason at gcc dot gnu.org
@ 2011-03-29 14:29 ` jason at gcc dot gnu.org
2011-03-29 14:35 ` jason at gcc dot gnu.org
2011-03-31 13:05 ` redi at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-29 14:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48313
--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-29 14:25:34 UTC ---
Author: jason
Date: Tue Mar 29 14:25:22 2011
New Revision: 171669
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171669
Log:
PR c++/48313
* pt.c (maybe_adjust_types_for_deduction): Handle T&& deduction
from overloaded function.
Added:
branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/rv-deduce2.C
Modified:
branches/gcc-4_6-branch/gcc/cp/ChangeLog
branches/gcc-4_6-branch/gcc/cp/pt.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/48313] [C++0x] std::bind with template function
2011-03-28 11:58 [Bug libstdc++/48313] New: std::bind with template function joerg.richter@pdv-fs.de
` (7 preceding siblings ...)
2011-03-29 14:29 ` jason at gcc dot gnu.org
@ 2011-03-29 14:35 ` jason at gcc dot gnu.org
2011-03-31 13:05 ` redi at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2011-03-29 14:35 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48313
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.6.1
--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2011-03-29 14:30:17 UTC ---
Fixed for 4.6.1.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/48313] [C++0x] std::bind with template function
2011-03-28 11:58 [Bug libstdc++/48313] New: std::bind with template function joerg.richter@pdv-fs.de
` (8 preceding siblings ...)
2011-03-29 14:35 ` jason at gcc dot gnu.org
@ 2011-03-31 13:05 ` redi at gcc dot gnu.org
9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-31 13:05 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48313
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-31 12:40:24 UTC ---
Thanks for the fix, Jason, I've just encountered the bug myself using
boost::thread
I expect others will to, so for the benefit of search engines, the error is
post_event_test.cc:130:47: error: cannot bind 'void()' lvalue to 'void (&&)()'
/home/jwakely/src/boost/boost_1_45_0/boost/thread/detail/thread.hpp:167:9:
error: initializing argument 1 of 'boost::thread::thread(F&&) [with F =
void()]'
^ permalink raw reply [flat|nested] 11+ messages in thread