summaryrefslogtreecommitdiff
path: root/Cython/Utility/ModuleSetupCode.c
diff options
context:
space:
mode:
authorRobert Bradshaw <robertwb@gmail.com>2016-11-15 20:56:59 -0800
committerRobert Bradshaw <robertwb@gmail.com>2016-11-15 20:56:59 -0800
commitff0fc55b6af6641fa67d43d6238a52770676c8fd (patch)
tree1270066d2afaddfe9168791ed73e7f7dd7255448 /Cython/Utility/ModuleSetupCode.c
parentf8c223d7b6a21380b3db46af05ce8e3ed03a0c8a (diff)
downloadcython-ff0fc55b6af6641fa67d43d6238a52770676c8fd.tar.gz
Allow taking address of fake references.
This fixes #1519.
Diffstat (limited to 'Cython/Utility/ModuleSetupCode.c')
-rw-r--r--Cython/Utility/ModuleSetupCode.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index 34d336d97..502bcad55 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -466,6 +466,7 @@ class __Pyx_FakeReference {
// Const version needed as Cython doesn't know about const overloads (e.g. for stl containers).
__Pyx_FakeReference(const T& ref) : ptr(const_cast<T*>(&ref)) { }
T *operator->() { return ptr; }
+ T *operator&() { return ptr; }
operator T&() { return *ptr; }
// TODO(robertwb): Delegate all operators (or auto-generate unwrapping code where needed).
template<typename U> bool operator ==(U other) { return *ptr == other; }