Generate an error and exit if trying to wrap a non-const scalar reference.

release/4.3a0
Simon Julier 2017-01-19 01:49:12 +00:00
parent ca9d175ad4
commit d8d7c5618a
1 changed files with 6 additions and 0 deletions

View File

@ -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