From d8d7c5618a11076a1a56a7e3232d4e195f70b1c8 Mon Sep 17 00:00:00 2001 From: Simon Julier Date: Thu, 19 Jan 2017 01:49:12 +0000 Subject: [PATCH] Generate an error and exit if trying to wrap a non-const scalar reference. --- wrap/Argument.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wrap/Argument.cpp b/wrap/Argument.cpp index a47c6711c..6badf7794 100644 --- a/wrap/Argument.cpp +++ b/wrap/Argument.cpp @@ -77,6 +77,12 @@ void Argument::matlab_unwrap(FileWriter& file, const string& matlabName) const { string matlabUniqueType = type.qualifiedName(); bool isNotScalar = !Argument::isScalar(); + // We cannot handle scalar non const references + if (!isNotScalar && is_ref && !is_const) { + cerr << "Cannot wrap a scalar non-const reference" << endl; + exit(-1); + } + if (is_ptr && type.category != Qualified::EIGEN) // A pointer: emit an "unwrap_shared_ptr" call which returns a pointer file.oss << "boost::shared_ptr<" << cppType << "> " << name