mirror of
https://github.com/opnsense/src.git
synced 2026-05-04 17:05:14 -04:00
Add pre-C++11 is_constructible wrappers for 3 arguments
Summary:
After rL319736 for D28253 (which fixes PR28929), gcc cannot compile
<memory> anymore in pre-C+11 modes, complaining:
In file included from /usr/include/c++/v1/memory:648:0,
from test.cpp:1:
/usr/include/c++/v1/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::make_shared(_A0&, _A1&, _A2&)':
/usr/include/c++/v1/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 /usr/include/c++/v1/memory:649:0,
from test.cpp:1:
/usr/include/c++/v1/type_traits:3198: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 /usr/include/c++/v1/memory:648:0,
from test.cpp:1:
/usr/include/c++/v1/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" );
^
/usr/include/c++/v1/memory: In static member function 'static std::__1::shared_ptr<_Tp> std::__1::shared_ptr<_Tp>::allocate_shared(const _Alloc&, _A0&, _A1&, _A2&)':
/usr/include/c++/v1/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 /usr/include/c++/v1/memory:649:0,
from test.cpp:1:
/usr/include/c++/v1/type_traits:3198: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 /usr/include/c++/v1/memory:648:0,
from test.cpp:1:
/usr/include/c++/v1/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" );
^
This is also reported in https://bugs.freebsd.org/224946 (FreeBSD is
apparently one of the very few projects that regularly builds
programs against libc++ with gcc).
The reason is that the static assertions are invoking
is_constructible with three arguments, while gcc does not have the
built-in is_constructible feature, and the pre-C++11 is_constructible
wrappers in <type_traits> only provide up to two arguments.
I have added additional wrappers for three arguments, modified the
is_constructible entry point to take three arguments instead, and
added a simple test to is_constructible.pass.cpp.
Reviewers: EricWF, mclow.lists
Reviewed By: EricWF
Subscribers: krytarowski, cfe-commits, emaste
Differential Revision: https://reviews.llvm.org/D41805
This should allow gcc to compile the libc++ 6.0.0 <memory> header
without problems, in pre-C++11 mode.
Reported by: jbeich
PR: 224946
|
||
|---|---|---|
| .. | ||
| experimental | ||
| ext | ||
| __bit_reference | ||
| __bsd_locale_defaults.h | ||
| __bsd_locale_fallbacks.h | ||
| __config | ||
| __debug | ||
| __functional_03 | ||
| __functional_base | ||
| __functional_base_03 | ||
| __hash_table | ||
| __libcpp_version | ||
| __locale | ||
| __mutex_base | ||
| __nullptr | ||
| __split_buffer | ||
| __sso_allocator | ||
| __std_stream | ||
| __string | ||
| __threading_support | ||
| __tree | ||
| __tuple | ||
| __undef_macros | ||
| algorithm | ||
| any | ||
| array | ||
| atomic | ||
| bitset | ||
| cassert | ||
| ccomplex | ||
| cctype | ||
| cerrno | ||
| cfenv | ||
| cfloat | ||
| chrono | ||
| cinttypes | ||
| ciso646 | ||
| climits | ||
| clocale | ||
| cmath | ||
| codecvt | ||
| complex | ||
| complex.h | ||
| condition_variable | ||
| csetjmp | ||
| csignal | ||
| cstdarg | ||
| cstdbool | ||
| cstddef | ||
| cstdint | ||
| cstdio | ||
| cstdlib | ||
| cstring | ||
| ctgmath | ||
| ctime | ||
| ctype.h | ||
| cwchar | ||
| cwctype | ||
| deque | ||
| errno.h | ||
| exception | ||
| float.h | ||
| forward_list | ||
| fstream | ||
| functional | ||
| future | ||
| initializer_list | ||
| inttypes.h | ||
| iomanip | ||
| ios | ||
| iosfwd | ||
| iostream | ||
| istream | ||
| iterator | ||
| limits | ||
| limits.h | ||
| list | ||
| locale | ||
| locale.h | ||
| map | ||
| math.h | ||
| memory | ||
| module.modulemap | ||
| mutex | ||
| new | ||
| numeric | ||
| optional | ||
| ostream | ||
| queue | ||
| random | ||
| ratio | ||
| regex | ||
| scoped_allocator | ||
| set | ||
| setjmp.h | ||
| shared_mutex | ||
| sstream | ||
| stack | ||
| stdbool.h | ||
| stddef.h | ||
| stdexcept | ||
| stdint.h | ||
| stdio.h | ||
| stdlib.h | ||
| streambuf | ||
| string | ||
| string.h | ||
| string_view | ||
| strstream | ||
| system_error | ||
| tgmath.h | ||
| thread | ||
| tuple | ||
| type_traits | ||
| typeindex | ||
| typeinfo | ||
| unordered_map | ||
| unordered_set | ||
| utility | ||
| valarray | ||
| variant | ||
| vector | ||
| wchar.h | ||
| wctype.h | ||