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

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

// PR c++/68478 - flexible array members have complete type
// { dg-do compile }
// { dg-options "-Wno-error=pedantic" }

// Test to verify that attempting to use a flexible array member where
// a complete type is required is rejected.

struct A {
  int n;
  int a[];
  enum {
    e = sizeof a   // { dg-error "invalid application of .sizeof. to incomplete type" }
  };
};

struct B {
  int n;
  typedef int A[];
  A a;
  enum {
    e = sizeof a   // { dg-error "invalid application of .sizeof. to incomplete type" }
  };
};