#include <string.h>

struct ip6addr {
  unsigned char u8[16];
};

unsigned char * foo(struct ip6_addr * addr, unsigned char * l);

/* Those 3 work... */
void * foo_two(struct ip6_addr * addr, unsigned char * l);
unsigned char * foo_three(struct ip6_addr * addr);
unsigned char * foo_four(unsigned char * addr, unsigned char * l);

void some_func(struct ip6_addr * addr, unsigned char * l)
{
  unsigned char a = 3;

  /* incompatible types */
  memcpy(addr, foo(addr, l), 8);

  /* The variants below work */
  /* cast to (void *) */
  memcpy(addr, (void *)foo(addr, l), 8);
  /* void * return value */
  memcpy(addr, foo_two(addr, l), 8);
  /* single argument */
  memcpy(addr, foo_three(addr), 8);
  /* Two arguments but none of type struct xyz * */
  memcpy(addr, foo_four(&a, l), 8);
}
