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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [tc1/] [dr142.C] - Blame information for rev 821

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile }
2
// Origin: Giovanni Bajo 
3
// DR142: Injection-related errors in access example
4
 
5
class B {                 // { dg-error "inaccessible" }
6
public:
7
  int mi;                 // { dg-error "inaccessible" }
8
  static int si;          // { dg-error "inaccessible" }
9
};
10
 
11
class D: private B {
12
};
13
 
14
class DD: public D {
15
  void f();
16
};
17
 
18
void DD::f() {
19
  mi = 3;          // { dg-error "within this context" "" }
20
  si = 3;          // { dg-error "within this context" "" }
21
  ::B b;
22
  b.mi = 3;
23
  b.si = 3;
24
  ::B::si = 3;
25
  ::B* bp1 = this;        // { dg-error "inaccessible base" "" }
26
  ::B* bp2 = (::B*)this;
27
  bp2->mi = 3;
28
 
29
 
30
  B b2;                   // { dg-error "within this context" "" }
31
  B::si = 3;              // { dg-error "within this context" "" }
32
}

powered by: WebSVN 2.1.0

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