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] - Blame information for rev 774

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

Line No. Rev Author Line
1 693 jeremybenn
// Negative test for defaulted/deleted fns.
2
// { dg-options "-std=c++0x" }
3
 
4
void f();                       // { dg-error "previous" }
5
void f() = delete;              // { dg-error "deleted" }
6
 
7
struct A
8
{
9
  A() { }                       // { dg-error "previous" }
10
  void f() = default;           // { dg-error "default" }
11
};
12
 
13
A::A() = default;               // { dg-error "redefinition" }
14
 
15
void g() {}                     // { dg-error "previous" }
16
void g() = delete;              // { dg-error "redefinition" }
17
 
18
struct B // { dg-message "user-provided default constructor" }
19
{
20
  int i;
21
  B() = default;                // { dg-message "not user-provided" }
22
};
23
 
24
const B b;                      // { dg-error "uninitialized const" }
25
 
26
struct C
27
{
28
  virtual void f() = delete;    // { dg-error "overriding deleted" }
29
};
30
 
31
struct D: public C
32
{
33
  virtual void f();             // { dg-error "non-deleted function" }
34
};
35
 
36
struct E
37
{
38
  const B b;
39
  E() { }                       // { dg-error "uninitialized" }
40
};
41
 
42
struct F
43
{
44
  F() = default;
45
  F(const F&) = delete;            // { dg-error "declared" }
46
};
47
 
48
struct G
49
{
50
  G();
51
};
52
 
53
// ctor defaulted after class defn is not trivial
54
G::G() = default;
55
 
56
union U
57
{
58
  G g;                          // { dg-error "union member.*non-trivial" }
59
};
60
 
61
int main()
62
{
63
  F f;
64
  F f2(f);                      // { dg-error "use" }
65
  B* b = new const B;           // { dg-error "uninitialized const" }
66
  U u;                          // { dg-error "deleted" }
67
}
68
 
69
// { dg-prune-output "implicitly deleted because" }

powered by: WebSVN 2.1.0

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