aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/m-un-2.c
blob: 0b96628355b165b885e06624e21297db1031e215 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* { dg-do compile } */
/* { dg-options "-W -Wall" } */

typedef __SIZE_TYPE__ size_t;
extern void* malloc (size_t);
extern void free (void*);
extern void* realloc (void*, size_t);

struct vtable {
  void* (* _malloc) (size_t);
  void (* _free) (void*);
  void* (* _realloc) (void*, size_t);
};

struct vtable mtable = {
  malloc,
  free
}; /* { dg-warning "missing initializer" "warning regression" { target *-*-* } {18} } */
   /* { dg-message "declared here" "warning regression 2" { target *-*-* } {12} } */

/* With designated initializers, we assume you meant to leave out the
   initialization of any blank fields.  */
struct vtable mtable2 = {
  ._malloc = malloc,
  ._realloc = realloc
};

struct vtable mtable3 = {
  ._free = free,
  ._malloc = malloc,
  ._realloc = realloc
};