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

// Positive test for defaulted/deleted fns
// { dg-do run { target c++11 } }

struct A
{
  int i;
  A() = default;
  A(const A&) = delete;
  A& operator=(const A&) = default;
  ~A();
};

A::~A() = default;

void f() = delete;

struct B
{
  int i;
  B() = default;
};

int main()
{
  A a1, a2;
#if __cplusplus <= 201703L
  B b = {1};
#endif
  a1 = a2;
}

// fns defaulted in class defn are trivial
struct C
{
  C() = default;
  C(const C&) = default;
  C& operator=(const C&) = default;
  ~C() = default;
};

union U
{
  C c;
};