FreeBSD -CURRENT plans to update base Clang to 6.0.0 soon. While testing this port failed to build. The underlying issue appears to be broken pre-C++11 support in libc++ when used by GCC. $ cat a.cc #include <memory> int main() { return 0; } $ g++7 -nostdinc++ -isystem/usr/include/c++/v1 -std=c++03 a.cc In file included from /usr/include/c++/v1/memory:648:0, from a.cc: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 a.cc: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 a.cc: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 a.cc: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 a.cc: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" ); ^ =======================<phase: configure >============================ ===> Configuring for GraphicsMagick-1.3.27,1 [...] checking whether the compiler supports ISO C++ standard library... no checking whether the compiler supports Standard Template Library... no checking whether the compiler supports ios::binary... no [...] checking whether C++ compiler is sufficient for Magick++... no (failed tests) [...] =======================<phase: package >============================ ===> Building package for GraphicsMagick-1.3.27,1 pkg-static: Unable to access file /wrkdirs/usr/ports/graphics/GraphicsMagick/work/stage/usr/local/bin/GraphicsMagick++-config:No such file or directory pkg-static: Unable to access file /wrkdirs/usr/ports/graphics/GraphicsMagick/work/stage/usr/local/include/GraphicsMagick/Magick++.h:No such file or directory pkg-static: Unable to access file /wrkdirs/usr/ports/graphics/GraphicsMagick/work/stage/usr/local/include/GraphicsMagick/Magick++/Blob.h:No such file or directory [...] To reproduce: $ poudriere jail -cj clang6-amd64 -a amd64 -v projects/clang600-import -m svn+https $ poudriere bulk -Ctj clang6-amd64 textproc/jade http://package18.nyi.freebsd.org/data/headamd64PR224669-default/2018-01-02_08h32m49s/logs/errors/GraphicsMagick-1.3.27,1.log
This regressed here: https://reviews.llvm.org/rL319736, obviously because the static_asserts were added there. I'll check with the author, Marshall Clow.
I submitted a review upstream: https://reviews.llvm.org/D41805
A commit references this bug: Author: dim Date: Sun Jan 7 18:33:19 UTC 2018 New revision: 327680 URL: https://svnweb.freebsd.org/changeset/base/327680 Log: Pull in r321963 from upstream libc++ trunk (by me): 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 Changes: projects/clang600-import/contrib/libc++/include/type_traits
This should now be fixed with r327680.