CC
CC copied to clipboard
Incomplete type analysis?
For the following program which is faulty (it gives an integer instead of a structure as argument of the map for the insert call),
#include <stdio.h>
#include <string.h>
#include "cc.h"
typedef struct { int x, y, z; } mp;
#define CC_CMPR mp, { return memcmp( &val_1, &val_2, sizeof (mp)); }
#define CC_HASH mp, { return val.x ^ val.y ^ val.z; }
#include "cc.h"
int main( void )
{
map(mp, mp) map;
init(&map);
if (!insert(&map, 12, 12)) {
abort();
}
cleanup(&map);
return 0;
}
the compilation succeeds with some "missing braces around initializer [-Wmissing-braces]" warnings whereas I was expecting a compilation failure or at least a warning about incompatible pointer.