view gcc/testsuite/g++.dg/ext/flexary8.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// 68689 - flexible array members in unions accepted in C++
// { dg-do compile }
// { dg-options "-Wno-error=pedantic" }

union U_i_ax {
    int i;
    int a[];                  // { dg-error "flexible array member in union" }
};

struct SU1 {
  union {
    int a[];                  // { dg-error "flexible array member in union" }
  };
};

struct SU2 {
  int n;
  union {
    int a[];                  // { dg-error "flexible array member in union" }
  };
};

struct SU3 {
  union {
    int n;
    int a[];                  // { dg-error "flexible array member in union" }
  };
};

union U_i_a0 {
    int i;
    int a[0];
};