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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [inherit/] [virtual5.C] - Blame information for rev 693

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// Test that a synthesized op= can override one from a base.
2
// { dg-do run }
3
 
4
struct B;
5
 
6
struct A
7
{
8
  virtual B& operator=(const B&);
9
};
10
 
11
struct B: A
12
{
13
  B(int i): i(i) { }
14
  int i;
15
  // implicitly-declared op=
16
};
17
 
18
B& A::operator=(const B& b) { return static_cast(*this); }
19
 
20
int main()
21
{
22
  B b1 (123);
23
  B b2 (0);
24
 
25
  A& ar = b1;
26
  ar = b2;
27
 
28
  return b1.i;
29
}

powered by: WebSVN 2.1.0

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