|
Boost : |
Subject: Re: [boost] [smart_ptr] extra colon on make_shared variadic template instantiation
From: Peter Dimov (lists_at_[hidden])
Date: 2013-09-19 03:53:00
Vicente J. Botet Escriba wrote:
> Hi,
>
> while instantiating this template, the Intel compiler finds that there is
> an extra colon when Args is empty.
>
>
> ::new( pv ) T( boost::detail::sp_forward<Arg1>( arg1 ),
> boost::detail::sp_forward<Args>( args )... );
> ^
> Is this a bug on the compiler or on Boost.SmartPtr?
I have no idea where an extra colon could come from, but maybe you mean an
extra comma. This should be a compiler bug.
> Hi,
>
> could I commit this patch
...
> +template< class T, class... Args > typename
> boost::detail::sp_if_not_array< T >::type make_shared( Args && ... args )
I'm not sure how this could help. This overload is either ambiguous with the
Arg1&& one, or less specialized. Do the make_shared tests pass on all
compilers after the patch?
The reason that there are two overloads, one without arguments, the other
with Arg1&& and Args&&..., is that earlier versions of g++ treated new
T(args...) as new T when args... is empty, instead of the correct new T().
There is a test that checks for this bug. If the current crop of supported
compilers no longer suffers from it, the two overloads can be replaced by
the simple variadic Args... version. But adding the Args... version in
addition to the other two makes no sense to me.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk