Expect 'struct netif *' but argument is of type 'struct netif *'

c

Solution

This "full program"

void foonetif(struct netif *dst) {
  if (dst) return;
  return;
}

struct netif {
  double bar;
};

int main(void) {
  struct netif *netif = 0; /* NULL */
  foonetif(netif);
  return 0;
}

generates this output from `gcc 10398683.c` (gcc version 4.6.3), so with all default options

10398683.c:1:22: warning: ‘struct netif’ declared inside parameter list [enabled by default]
10398683.c:1:22: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
10398683.c: In function ‘main’:
10398683.c:12:3: warning: passing argument 1 of ‘newnetif’ from incompatible pointer type [enabled by default]
10398683.c:1:6: note: expected ‘struct netif *’ but argument is of type ‘struct netif *’

Note the last warning (really a note) :)

Problem

I get the following error with gcc when I declare a `struct netif *` from a function scope (where the compile doesn't complain) to global scope: ``` src/main.c:114:3: warning: passing argument 1 of 'low_level_init' from incompatible pointer type [enabled by default] src/main.c:62:13: note: expected 'struct netif *' but argument is of type 'struct netif *' ``` Why is does compiler give the following "non-sensical" complaint? `expected 'stuct netif *' but argument is of type 'struct netif *'`

Original source

Related problems