http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48113
Summary: [C++0x] bind with tuple argument fails Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: martin.kronbich...@it.uu.se Compiler version: $ gcc-4.6 -v Using built-in specs. COLLECT_GCC=gcc-4.6 COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.0/lto-wrapper Target: x86_64-linux-gnu Configured with: ../configure --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --libexecdir=/usr/lib --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --without-included-gettext --enable-threads=posix --program-suffix=-4.6 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i486 --with-tune=core2 --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-cpu=core2 Thread model: posix gcc version 4.6.0 20110312 (experimental) (GCC) (weekly snapshot on x86_64) On the following code: #include <functional> void test_1 (std::tuple<int>); void test (int tst) { const std::function<void()> fun (std::bind(&test_1, std::tuple<int>(tst))); }; with the command line "g++-4.6 -std=c++0x -c bind_test.cc -o bind_tst.o", I get the following error message: In file included from bind_test.cc:2:0: /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/functional: In static member function ‘static void std::_Function_handler<void(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes ...) [with _Functor = std::_Bind<void (*(std::tuple<int>))(std::tuple<int>)>, _ArgTypes = {}]’: /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/functional:2135:6: instantiated from ‘std::function<_Res(_ArgTypes ...)>::function(_Functor, typename std::enable_if<(! std::is_integral<_Functor>::value), std::function<_Res(_ArgTypes ...)>::_Useless>::type) [with _Functor = std::_Bind<void (*(std::tuple<int>))(std::tuple<int>)>, _Res = void, _ArgTypes = {}, typename std::enable_if<(! std::is_integral<_Functor>::value), std::function<_Res(_ArgTypes ...)>::_Useless>::type = std::function<void()>::_Useless]’ bind_test.cc:6:76: instantiated from here /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/functional:1765:9: error: no matching function for call to ‘std::tuple<int>::tuple(const volatile std::tuple<int>&)’ /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/functional:1765:9: note: candidates are: /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:441:32: note: template<class _U1> std::tuple<_T1>::tuple(std::tuple<_U1>&&) /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:437:37: note: template<class _U1> std::tuple<_T1>::tuple(const std::tuple<_U1>&) /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:433:7: note: std::tuple<_T1>::tuple(std::tuple<_T1>&&) [with _T1 = int, std::tuple<_T1> = std::tuple<int>] /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:433:7: note: no known conversion for argument 1 from ‘const volatile std::tuple<int>’ to ‘std::tuple<int>&&’ /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:431:17: note: constexpr std::tuple<_T1>::tuple(const std::tuple<_T1>&) [with _T1 = int, std::tuple<_T1> = std::tuple<int>] /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:431:17: note: no known conversion for argument 1 from ‘const volatile std::tuple<int>’ to ‘const std::tuple<int>&’ /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:418:17: note: constexpr std::tuple<_T1>::tuple() [with _T1 = int] /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:418:17: note: candidate expects 0 arguments, 1 provided /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/functional:1765:9: error: no matching function for call to ‘std::tuple<int>::tuple(volatile std::tuple<int>&)’ /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/functional:1765:9: note: candidates are: /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:441:32: note: template<class _U1> std::tuple<_T1>::tuple(std::tuple<_U1>&&) /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:437:37: note: template<class _U1> std::tuple<_T1>::tuple(const std::tuple<_U1>&) /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:433:7: note: std::tuple<_T1>::tuple(std::tuple<_T1>&&) [with _T1 = int, std::tuple<_T1> = std::tuple<int>] /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:433:7: note: no known conversion for argument 1 from ‘volatile std::tuple<int>’ to ‘std::tuple<int>&&’ /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:431:17: note: constexpr std::tuple<_T1>::tuple(const std::tuple<_T1>&) [with _T1 = int, std::tuple<_T1> = std::tuple<int>] /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:431:17: note: no known conversion for argument 1 from ‘volatile std::tuple<int>’ to ‘const std::tuple<int>&’ /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:418:17: note: constexpr std::tuple<_T1>::tuple() [with _T1 = int] /usr/lib/gcc/x86_64-linux-gnu/4.6.0/../../../../include/c++/4.6.0/tuple:418:17: note: candidate expects 0 arguments, 1 provided Since I can't see anything illegal with the code, my guess is that it is a problem with the C++0x headers (the compilation is fine with gcc 4.5.2 with -std=c++0x argument).