diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c
index cffec7880..005e6109b 100644
--- a/src/cc65/datatype.c
+++ b/src/cc65/datatype.c
@@ -1009,6 +1009,20 @@ Type* Indirect (Type* T)
 
 
 
+const Type* IndirectConst (const Type* T)
+/* Do one indirection for the given type, that is, return the type where the
+** given type points to.
+*/
+{
+    /* We are expecting a pointer expression */
+    CHECK (IsClassPtr (T));
+
+    /* Skip the pointer or array token itself */
+    return T + 1;
+}
+
+
+
 Type* ArrayToPtr (Type* T)
 /* Convert an array to a pointer to it's first element */
 {
diff --git a/src/cc65/datatype.h b/src/cc65/datatype.h
index 66f1b8b05..6cbad302f 100644
--- a/src/cc65/datatype.h
+++ b/src/cc65/datatype.h
@@ -345,6 +345,11 @@ Type* Indirect (Type* T);
 ** given type points to.
 */
 
+const Type* IndirectConst (const Type* T);
+/* Do one indirection for the given type, that is, return the type where the
+** given type points to.
+*/
+
 Type* ArrayToPtr (Type* T);
 /* Convert an array to a pointer to it's first element */
 
diff --git a/src/cc65/typeconv.c b/src/cc65/typeconv.c
index c3c1a2528..7e2787529 100644
--- a/src/cc65/typeconv.c
+++ b/src/cc65/typeconv.c
@@ -192,7 +192,7 @@ ExitPoint:
 
 
 
-void TypeConversion (ExprDesc* Expr, Type* NewType)
+void TypeConversion (ExprDesc* Expr, const Type* NewType)
 /* Do an automatic conversion of the given expression to the new type. Output
 ** warnings or errors where this automatic conversion is suspicious or
 ** impossible.
@@ -264,7 +264,7 @@ void TypeConversion (ExprDesc* Expr, Type* NewType)
             **   - the rhs pointer is a void pointer, or
             **   - the lhs pointer is a void pointer.
             */
-            if (!IsTypeVoid (Indirect (NewType)) && !IsTypeVoid (Indirect (Expr->Type))) {
+            if (!IsTypeVoid (IndirectConst (NewType)) && !IsTypeVoid (Indirect (Expr->Type))) {
                 /* Compare the types */
                 switch (TypeCmp (NewType, Expr->Type)) {
 
diff --git a/src/cc65/typeconv.h b/src/cc65/typeconv.h
index 5c94069a3..0a82eac27 100644
--- a/src/cc65/typeconv.h
+++ b/src/cc65/typeconv.h
@@ -52,7 +52,7 @@
 void TypeCompatibilityDiagnostic (const Type* NewType, const Type* OldType, int IsError, const char* Msg);
 /* Print error or warning message about type conversion with proper type names */
 
-void TypeConversion (ExprDesc* Expr, Type* NewType);
+void TypeConversion (ExprDesc* Expr, const Type* NewType);
 /* Do an automatic conversion of the given expression to the new type. Output
 ** warnings or errors where this automatic conversion is suspicious or
 ** impossible.