8000 Merge pull request #197 from PerretB/explicit_long_long_allocator_ins… · robertodr/xtensor-python@9e57798 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9e57798

Browse files
authored
Merge pull request xtensor-stack#197 from PerretB/explicit_long_long_allocator_instanciation
Explicit long long allocator instantiation
2 parents 368fd65 + 8b7ed6b commit 9e57798

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

docs/source/compilers.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. Copyright (c) 2016, Johan Mabille, Sylvain Corlay and Wolf Vollprecht
2+
3+
Distributed under the terms of the BSD 3-Clause License.
4+
5+
The full license is in the file LICENSE, distributed with this software.
6+
7+
Compiler workarounds
8+
====================
9+
10+
This page tracks the workarounds for the various compiler issues that we
11+
encountered in the development. This is mostly of interest for developers
12+
interested in contributing to xtensor-python.
13+
14+
GCC and ``std::allocator<long long>``
15+
-------------------------------------
16+
17+
GCC sometimes fails to automatically instantiate the ``std::allocator``
18+
class template for the types ``long long`` and ``unsigned long long``.
19+
Those allocators are thus explicitly instantiated in the dummy function
20+
``void long_long_allocator()`` in the file ``py_container.hpp``.

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ This software is licensed under the BSD-3-Clause license. See the LICENSE file f
7373
.. toctree::
7474
:caption: DEVELOPER ZONE
7575

76+
compilers
7677
releasing
7778

7879
.. _NumPy: http://www.numpy.org

include/xtensor-python/pycontainer.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,18 @@ namespace xt
455455
}
456456
#endif
457457
}
458+
459+
#if defined(__GNUC__) && !defined(__clang__)
460+
namespace workaround
461+
{
462+
// Fixes "undefined symbol" issues
463+
inline void long_long_allocator()
464+
{
465+
std::allocator<long long> a;
466+
std::allocator<unsigned long long> b;
467+
}
468+
}
469+
#endif
458470
}
459471

460472
#endif

0 commit comments

Comments
 (0)
0