view gcc/testsuite/g++.dg/cpp0x/nsdmi-anon-struct1.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

// PR c++/66644
// { dg-do compile { target c++11 } }
// { dg-options "-Wno-pedantic" }

struct test1  
{
  union
  {
    struct { char a=0, b=0; };
    char buffer[16];
  };
};

struct test2 
{
  union  
  {
    struct { char a=0, b; };
    char buffer[16];
  };
};

struct test3
{
  union
  {
    struct { char a, b; } test2{0,0};
    char buffer[16];
  };
};

struct test4
{
  union  
  {   // { dg-error "multiple fields" }
    struct { char a=0, b=0; };
    struct { char c=0, d; };
  };
};

struct test5
{
  union
  {
    union { char a=0, b=0; };  // { dg-error "multiple fields" }
    char buffer[16];
  };
};