view gcc/testsuite/g++.dg/ext/flexary16.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++/71147 - [6 Regression] Flexible array member wrongly rejected
//   in template
// { dg-do compile }
// { dg-options "-Wpedantic -Wno-error=pedantic" }

template <typename>
struct container
{
  struct elem {
    unsigned u;
  };

  struct incomplete {
    int x;
    elem array[];  // { dg-warning "forbids flexible array member" }
  };
};

unsigned f (container<void>::incomplete* i)
{
  return i->array [0].u;
}


template <typename T>
struct D: container<T>
{
  struct S {
    int x;
    typename container<T>::elem array[];  // { dg-warning "forbids flexible array member" }
  };
};


unsigned g (D<void>::S *s)
{
  return s->array [0].u;
}