OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [cpp0x/] [defaulted2.C] - Rev 774

Go to most recent revision | Compare with Previous | Blame | View Log

// Negative test for defaulted/deleted fns.
// { dg-options "-std=c++0x" }

void f();                       // { dg-error "previous" }
void f() = delete;              // { dg-error "deleted" }

struct A
{
  A() { }                       // { dg-error "previous" }
  void f() = default;           // { dg-error "default" }
};

A::A() = default;               // { dg-error "redefinition" }

void g() {}                     // { dg-error "previous" }
void g() = delete;              // { dg-error "redefinition" }

struct B // { dg-message "user-provided default constructor" }
{
  int i;
  B() = default;                // { dg-message "not user-provided" }
};

const B b;                      // { dg-error "uninitialized const" }

struct C
{
  virtual void f() = delete;    // { dg-error "overriding deleted" }
};

struct D: public C
{
  virtual void f();             // { dg-error "non-deleted function" }
};

struct E
{
  const B b;
  E() { }                       // { dg-error "uninitialized" }
};

struct F
{
  F() = default;
  F(const F&) = delete;         // { dg-error "declared" }
};

struct G
{
  G();
};

// ctor defaulted after class defn is not trivial
G::G() = default;

union U
{
  G g;                          // { dg-error "union member.*non-trivial" }
};

int main()
{
  F f;
  F f2(f);                      // { dg-error "use" }
  B* b = new const B;           // { dg-error "uninitialized const" }
  U u;                          // { dg-error "deleted" }
}

// { dg-prune-output "implicitly deleted because" }

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.