summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/slice2swift/Gen.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp
index fd856e8af8f..a1e79ac6bf7 100644
--- a/cpp/src/slice2swift/Gen.cpp
+++ b/cpp/src/slice2swift/Gen.cpp
@@ -869,8 +869,7 @@ Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << sp;
out << nl << "func read() throws -> " << name;
out << sb;
- out << nl << "var rawValue = " << enumType << "()";
- out << nl << "try read(enum: &rawValue, maxValue: " << p->maxValue() << ")";
+ out << nl << "let rawValue: " << enumType << " = try read(enumMaxValue: " << p->maxValue() << ")";
out << nl << "guard let val = " << name << "(rawValue: rawValue) else";
out << sb;
out << nl << "throw " << getUnqualified("Ice.MarshalException", swiftModule) << "(reason: \"invalid enum value\")";