The ‘invalid use of void expression’ error occurs when you try to assign a call to a void function to a variable. It also occurs when a void function operands with a different data type.

Even if the error does not occur in the original source file, the error may occur during the Controller Tester test process.

typedef unsigned int uint8_t;

typedef volatile uint8_t register8_t;

typedef struct PORT_struct
{
    register8_t DIR;   
    ...
} PORT_t;

static static void PORTE_set_port_dir(void)
{
	uint8_t i;
	*((uint8_t *)&(*(PORT_t *) 0x0480) + 0x10 + i) |= 1 << 3;
}

The above example is using type punning and directly accessing the memory address by casting the constant to a pointer.
In this case, if the virtual memory option is being used, the contents of the function are wrapped with the void *CS_UT_get_host_addr(unsigned int addr, unsigned int size); function during conversion.
Since the CS_UT_get_host_addr function is of void type, the corresponding error occurs when operands as integers.

Need more help with this?
Don’t hesitate to contact us here.

Thanks for your feedback.