Skip to content

Incomplete type analysis? #6

Description

@P-p-H-d

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions