Perfect forwarding seems not to be so perfect
Paolo Carlini
paolo.carlini@oracle.com
Tue Dec 6 15:23:00 GMT 2011
On 12/06/2011 04:11 PM, Piotr Wyderski wrote:
> Hello,
>
> on gcc-4.6.2/x64/linux:
>
> template<typename... TA> inline string format(const string& fmt,
> TA&&... args) {
>
> string_formatter f;
> f.format(fmt, std::forward<TA>(args)...);
> return f.get_result();
> }
>
> results in:
>
> error: no matching function for call to 'forward(const char* const&)'
> note: candidates are:
> /opt/a3d/stow/gcc-4.6.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/move.h:62:5:
> note: template<class _Tp> _Tp&& std::forward(typename
> std::remove_reference<_Tp>::type&)
> /opt/a3d/stow/gcc-4.6.2/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../include/c++/4.6.2/bits/move.h:67:5:
> note: template<class _Tp> _Tp&& std::forward(typename
> std::remove_reference<_Tp>::type&&)
>
> Should I report it as a standard library bug?
Whatever it is, can't be a library bug, because the implementation
follows trivially the letter of the Standard.
Paolo.
More information about the Gcc
mailing list