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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [other/] [copy2.C] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run }
2
 
3
// Test that A's copy assignment method is called when B's instance
4
// member array of A is assigned.
5
 
6
// Contributed by Brian Gaeke, public domain.
7
int status = 1;
8
 
9
class A
10
{
11
public:
12
  int i;
13
  A &operator =(const A &i)
14
  {
15
    status = 0;
16
  }
17
};
18
 
19
class B
20
{
21
public:
22
  A arr[10];
23
};
24
 
25
int main (int argc, char **argv)
26
{
27
  B b;
28
  b.arr[0].i = 15;
29
  B a;
30
  a = b; // trigger copy assignment
31
  return status;
32
}

powered by: WebSVN 2.1.0

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