[libcxx] r319736 - Land D28253 which fixes PR28929 (which we mistakenly marked as fixed before)

Dimitry Andric via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 6 16:19:06 PST 2018


On 5 Dec 2017, at 05:09, Marshall Clow via cfe-commits <cfe-commits at lists.llvm.org> wrote:
> 
> Author: marshall
> Date: Mon Dec  4 20:09:49 2017
> New Revision: 319736
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=319736&view=rev
> Log:
> Land D28253 which fixes PR28929 (which we mistakenly marked as fixed before)
...
> --- libcxx/trunk/include/memory (original)
> +++ libcxx/trunk/include/memory Mon Dec  4 20:09:49 2017
...
> @@ -4357,6 +4362,7 @@ template<class _A0, class _A1, class _A2
> shared_ptr<_Tp>
> shared_ptr<_Tp>::make_shared(_A0& __a0, _A1& __a1, _A2& __a2)
> {
> +    static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" );
>     typedef __shared_ptr_emplace<_Tp, allocator<_Tp> > _CntrlBlk;
>     typedef allocator<_CntrlBlk> _Alloc2;
>     typedef __allocator_destructor<_Alloc2> _D2;

This commit causes g++ to no longer be able to compile <memory> in pre-C++11 mode, giving errors in the static assertions, like the following:

$ g++7 -nostdinc++ -isystem /share/dim/src/libcxx/trunk/include -std=c++03 -c test.cpp
In file included from /share/dim/src/libcxx/trunk/include/memory:648:0,
                 from test.cpp:1:
/share/dim/src/libcxx/trunk/include/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::make_shared(_A0&, _A1&, _A2&)':
/share/dim/src/libcxx/trunk/include/memory:4365:5: error: wrong number of template arguments (4, should be at least 1)
     static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" );
     ^
In file included from /share/dim/src/libcxx/trunk/include/memory:649:0,
                 from test.cpp:1:
/share/dim/src/libcxx/trunk/include/type_traits:3193:29: note: provided for 'template<class _Tp, class _A0, class _A1> struct std::__1::is_constructible'
 struct _LIBCPP_TEMPLATE_VIS is_constructible
                             ^~~~~~~~~~~~~~~~
In file included from /share/dim/src/libcxx/trunk/include/memory:648:0,
                 from test.cpp:1:
/share/dim/src/libcxx/trunk/include/memory:4365:5: error: template argument 1 is invalid
     static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in make_shared" );
     ^
/share/dim/src/libcxx/trunk/include/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::allocate_shared(const _Alloc&, _A0&, _A1&, _A2&)':
/share/dim/src/libcxx/trunk/include/memory:4444:5: error: wrong number of template arguments (4, should be at least 1)
     static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" );
     ^
In file included from /share/dim/src/libcxx/trunk/include/memory:649:0,
                 from test.cpp:1:
/share/dim/src/libcxx/trunk/include/type_traits:3193:29: note: provided for 'template<class _Tp, class _A0, class _A1> struct std::__1::is_constructible'
 struct _LIBCPP_TEMPLATE_VIS is_constructible
                             ^~~~~~~~~~~~~~~~
In file included from /share/dim/src/libcxx/trunk/include/memory:648:0,
                 from test.cpp:1:
/share/dim/src/libcxx/trunk/include/memory:4444:5: error: template argument 1 is invalid
     static_assert((is_constructible<_Tp, _A0, _A1, _A2>::value), "Can't construct object in allocate_shared" );
     ^

It could be a gcc problem, since clang does not complain about it, but hints on how to solve it would be welcome.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 223 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180107/815b64c0/attachment.sig>


More information about the cfe-commits mailing list