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

// Negative test for C++11 unrestricted unions
// { dg-do compile { target c++11 } }
// { dg-prune-output "implicitly deleted because" }

struct A
{
  A();
  A(const A&);
  ~A();
};

union B
{
  A a;				// { dg-error "union member" }
};

B b;				// { dg-error "B::B\\(\\)" "B::B" }
B b2(b);			// { dg-error "B::B\\(const B&\\)" "B::B" }

struct C
{
  union
  {
    A a;			// { dg-error "union member" }
  };
};

C c;				// { dg-error "C::C\\(\\)" "C::C" }
C c2(c);			// { dg-error "C::C\\(const C&\\)" "C::C" }

// { dg-error "B::~B" "B::~B" { target *-*-* } 17 }
// { dg-error "B::~B" "B::~B" { target *-*-* } 18 }
// { dg-error "C::~C" "C::~C" { target *-*-* } 28 }
// { dg-error "C::~C" "C::~C" { target *-*-* } 29 }