Support C++17 aligned new statement (#1582)

* Support C++17 aligned new statement

This patch makes pybind11 aware of nonstandard alignment requirements in
bound types and passes on this information to C++17 aligned 'new'
operator. Pre-C++17, the behavior is unchanged.
This commit is contained in:
Wenzel Jakob
2018-11-09 20:14:53 +01:00
committed by GitHub
parent adc2cdd5c4
commit e2eca4f8f8
6 changed files with 55 additions and 8 deletions

View File

@@ -273,3 +273,9 @@ def test_error_after_conversions():
m.test_error_after_conversions("hello")
assert str(exc_info.value).startswith(
"Unable to convert function return value to a Python type!")
def test_aligned():
if hasattr(m, "Aligned"):
p = m.Aligned().ptr()
assert p % 1024 == 0