diff --git a/docs/source/compilers.rst b/docs/source/compilers.rst new file mode 100644 index 0000000..62ef028 --- /dev/null +++ b/docs/source/compilers.rst @@ -0,0 +1,20 @@ +.. Copyright (c) 2016, Johan Mabille, Sylvain Corlay and Wolf Vollprecht + + Distributed under the terms of the BSD 3-Clause License. + + The full license is in the file LICENSE, distributed with this software. + +Compiler workarounds +==================== + +This page tracks the workarounds for the various compiler issues that we +encountered in the development. This is mostly of interest for developers +interested in contributing to xtensor-python. + +GCC and ``std::allocator`` +------------------------------------- + +GCC sometimes fails to automatically instantiate the ``std::allocator`` +class template for the types ``long long`` and ``unsigned long long``. +Those allocators are thus explicitly instantiated in the dummy function +``void long_long_allocator()`` in the file ``py_container.hpp``. diff --git a/docs/source/index.rst b/docs/source/index.rst index 72ff792..950559f 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -73,6 +73,7 @@ This software is licensed under the BSD-3-Clause license. See the LICENSE file f .. toctree:: :caption: DEVELOPER ZONE + compilers releasing .. _NumPy: http://www.numpy.org diff --git a/include/xtensor-python/pycontainer.hpp b/include/xtensor-python/pycontainer.hpp index 03a27e3..b71f177 100644 --- a/include/xtensor-python/pycontainer.hpp +++ b/include/xtensor-python/pycontainer.hpp @@ -455,6 +455,18 @@ namespace xt } #endif } + +#if defined(__GNUC__) && !defined(__clang__) + namespace workaround + { + // Fixes "undefined symbol" issues + inline void long_long_allocator() + { + std::allocator a; + std::allocator b; + } + } +#endif } #endif