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

            Bug ID: 77559
           Summary: Implicit conversion from pointer to reference fails
           Product: gcc
           Version: 6.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: monochromec at gmail dot com
  Target Milestone: ---

Created attachment 39604
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39604&action=edit
Preprocessor output as requestd in bug filing guidelines

When compiling sinfo-0.0.48 with the latest version of boost (1.61.0) g++ fails
issuing the following error message: 

/usr/include/boost/bind/bind.hpp:319:35: error: no match for call to
‘(boost::_mfi::mf1<void, TCPMessageServerConnection, Message&>)
(TCPMessageServerConnection*&, Message)’
         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/bind/mem_fn.hpp:215:0,
                 from /usr/include/boost/mem_fn.hpp:22,
                 from /usr/include/boost/bind/bind.hpp:26,
                 from /usr/include/boost/bind.hpp:22,
                 from tcpmessageserverconnection.cc:2:
/usr/include/boost/bind/mem_fn_template.hpp:163:7: note: candidate: R
boost::_mfi::mf1<R, T, A1>::operator()(T*, A1) const [with R = void; T =
TCPMessageServerConnection; A1 = Message&] <near match>
     R operator()(T * p, A1 a1) const
       ^~~~~~~~
/usr/include/boost/bind/mem_fn_template.hpp:163:7: note:   conversion of
argument 2 would be ill-formed:
In file included from /usr/include/boost/bind.hpp:22:0,
                 from tcpmessageserverconnection.cc:2:
/usr/include/boost/bind/bind.hpp:319:35: error: invalid initialization of
non-const reference of type ‘Message&’ from an rvalue of type ‘Message’
         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/bind/mem_fn.hpp:215:0,
                 from /usr/include/boost/mem_fn.hpp:22,
                 from /usr/include/boost/bind/bind.hpp:26,
                 from /usr/include/boost/bind.hpp:22,
                 from tcpmessageserverconnection.cc:2:
/usr/include/boost/bind/mem_fn_template.hpp:168:25: note: candidate:
template<class U> R boost::_mfi::mf1<R, T, A1>::operator()(U&, A1) const [with
U = U; R = void; T = TCPMessageServerConnection; A1 = Message&]
     template<class U> R operator()(U & u, A1 a1) const
                         ^~~~~~~~
/usr/include/boost/bind/mem_fn_template.hpp:168:25: note:   template argument
deduction/substitution failed:
In file included from /usr/include/boost/bind.hpp:22:0,
                 from tcpmessageserverconnection.cc:2:
/usr/include/boost/bind/bind.hpp:319:35: note:   cannot convert ‘(&
a)->boost::_bi::rrlist1<A1>::operator[]<Message>(boost::_bi::storage2<A1,
boost::arg<I> >::a2_<boost::_bi::value<TCPMessageServerConnection*>, 1>)’ (type
‘Message’) to type ‘Message&’
         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/bind/mem_fn.hpp:215:0,
                 from /usr/include/boost/mem_fn.hpp:22,
                 from /usr/include/boost/bind/bind.hpp:26,
                 from /usr/include/boost/bind.hpp:22,
                 from tcpmessageserverconnection.cc:2:
/usr/include/boost/bind/mem_fn_template.hpp:176:25: note: candidate:
template<class U> R boost::_mfi::mf1<R, T, A1>::operator()(const U&, A1) const
[with U = U; R = void; T = TCPMessageServerConnection; A1 = Message&]
     template<class U> R operator()(U const & u, A1 a1) const
                         ^~~~~~~~
/usr/include/boost/bind/mem_fn_template.hpp:176:25: note:   template argument
deduction/substitution failed:
In file included from /usr/include/boost/bind.hpp:22:0,
                 from tcpmessageserverconnection.cc:2:
/usr/include/boost/bind/bind.hpp:319:35: note:   cannot convert ‘(&
a)->boost::_bi::rrlist1<A1>::operator[]<Message>(boost::_bi::storage2<A1,
boost::arg<I> >::a2_<boost::_bi::value<TCPMessageServerConnection*>, 1>)’ (type
‘Message’) to type ‘Message&’
         unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/bind/mem_fn.hpp:215:0,
                 from /usr/include/boost/mem_fn.hpp:22,
                 from /usr/include/boost/bind/bind.hpp:26,
                 from /usr/include/boost/bind.hpp:22,
                 from tcpmessageserverconnection.cc:2:
/usr/include/boost/bind/mem_fn_template.hpp:184:7: note: candidate: R
boost::_mfi::mf1<R, T, A1>::operator()(T&, A1) const [with R = void; T =
TCPMessageServerConnection; A1 = Message&]
     R operator()(T & t, A1 a1) const
       ^~~~~~~~
/usr/include/boost/bind/mem_fn_template.hpp:184:7: note:   no known conversion
for argument 1 from ‘TCPMessageServerConnection*’ to
‘TCPMessageServerConnection&’

in file libmessageio/tcpmessageserverconnection.cc

Build / target system is a ARMV7H running Arch (ALARM). Same error happens on a
V5 too (same OS). 

g++ build configuration:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/armv7l-unknown-linux-gnueabihf/6.2.1/lto-wrapper
Target: armv7l-unknown-linux-gnueabihf
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues
--enable-languages=c,c++,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-lto --enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib
--disable-werror --enable-checking=release
--host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf
--with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16
Thread model: posix
gcc version 6.2.1 20160830 (GCC) 

Please find the .i file attached. The source file in question compiles with
CLANG w/o any issues. Any further questions please let me know.

Reply via email to