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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [inherit/] [operator1.C] - Blame information for rev 149

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

Line No. Rev Author Line
1 149 jeremybenn
// Test that conversions to base classes happen when calling
2
// operators.
3
 
4
// { dg-do run }
5
 
6
extern "C" void abort ();
7
 
8
struct B1;
9
struct B2;
10
 
11
B2* p;
12
B1* p2;
13
 
14
struct B1 {
15
  virtual void f () {}
16
};
17
 
18
struct B2 {
19
  int i;
20
  bool operator!() { if (this != p) abort (); return true; }
21
  operator void*() { if (this != p) abort (); return this; }
22
};
23
 
24
struct B3 : public B1, public B2 {
25
};
26
 
27
int main () {
28
  B3 b;
29
  p = (B2*) &b;
30
  p2 = (B1*) &b;
31
  bool b1 = b;
32
  bool b2 = !b;
33
}
34
 

powered by: WebSVN 2.1.0

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