diff --git a/cpp/src/ice2slice/Gen.cpp b/cpp/src/ice2slice/Gen.cpp index 5aa521ed008..9d76f7e5aa0 100644 --- a/cpp/src/ice2slice/Gen.cpp +++ b/cpp/src/ice2slice/Gen.cpp @@ -730,13 +730,13 @@ void Slice::Gen::TypesVisitor::visitConst(const ConstPtr& p) { string typeString; - if (auto builtin = dynamic_pointer_cast(p)) + if (auto builtin = dynamic_pointer_cast(p->type())) { typeString = builtin->kindAsString(); } else { - auto constructed = dynamic_pointer_cast(p); + auto constructed = dynamic_pointer_cast(p->type()); assert(constructed); typeString = constructed->scoped(); }