diff --git a/interpreter/cling/lib/Interpreter/ValuePrinter.cpp b/interpreter/cling/lib/Interpreter/ValuePrinter.cpp
index 9311bf84a894ff4cb6e7d4afda0cfb1b6bd13e71..9229059f912ca352cdc2fc6af313bc938ba94d75 100644
--- a/interpreter/cling/lib/Interpreter/ValuePrinter.cpp
+++ b/interpreter/cling/lib/Interpreter/ValuePrinter.cpp
@@ -576,10 +576,11 @@ static const char* BuildAndEmitVPWrapperBody(cling::Interpreter &Interp,
   if (auto PT = llvm::dyn_cast<clang::PointerType>(QT.getTypePtr())) {
     // Normalize `X*` to `const void*`, invoke `printValue(const void**)`,
     // unless it's a character string.
-    if (!Ctx.hasSameType(PT->getPointeeType().getUnqualifiedType(), Ctx.CharTy)
-        && !Ctx.hasSameType(PT->getPointeeType().getUnqualifiedType(), Ctx.WCharTy)
-        && !Ctx.hasSameType(PT->getPointeeType().getUnqualifiedType(), Ctx.Char16Ty)
-        && !Ctx.hasSameType(PT->getPointeeType().getUnqualifiedType(), Ctx.Char32Ty)) {
+    clang::QualType QTPointeeUnqual = PT->getPointeeType().getUnqualifiedType();
+    if (!Ctx.hasSameType(QTPointeeUnqual, Ctx.CharTy)
+        && !Ctx.hasSameType(QTPointeeUnqual, Ctx.WCharTy)
+        && !Ctx.hasSameType(QTPointeeUnqual, Ctx.Char16Ty)
+        && !Ctx.hasSameType(QTPointeeUnqual, Ctx.Char32Ty)) {
       QT = Ctx.VoidTy;
       QT.addConst();
       QT = Ctx.getPointerType(QT);